Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Improve panic message on invalid handler returns #415

Merged
merged 1 commit into from
Dec 8, 2022
Merged

Conversation

akshayjshah
Copy link
Member

If a handler returns nil, nil, we're going to panic during
serialization. However, those stacktraces don't include any frames from
the handler itself, so it's very difficult to determine what the problem
is. This PR panics explicitly a bit earlier, so that we can include the
procedure name in the error message.

Fixes #405.

If a handler returns `nil, nil`, we're going to panic during
serialization. However, those stacktraces don't include any frames from
the handler itself, so it's very difficult to determine what the problem
is. This PR panics explicitly a bit earlier, so that we can include the
procedure name in the error message.

Fixes #405.
Copy link
Contributor

@jchadwick-buf jchadwick-buf left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM, tested it and got the expected error message now:

2022/12/08 09:16:56 http: panic serving 127.0.0.1:51672: /ping.v1.PingService/Ping returned nil *connect.Response and nil error

@akshayjshah akshayjshah merged commit 63b817f into main Dec 8, 2022
@akshayjshah akshayjshah deleted the ajs/panics branch December 8, 2022 15:03
renovate bot referenced this pull request in open-feature/flagd Jan 12, 2023
[![Mend
Renovate](https://app.renovatebot.com/images/banner.svg)](https://renovatebot.com)

This PR contains the following updates:

| Package | Type | Update | Change |
|---|---|---|---|
|
[github.com/bufbuild/connect-go](https://togithub.com/bufbuild/connect-go)
| require | minor | `v1.3.1` -> `v1.4.1` |

---

### Release Notes

<details>
<summary>bufbuild/connect-go</summary>

###
[`v1.4.1`](https://togithub.com/bufbuild/connect-go/releases/tag/v1.4.1)

[Compare
Source](https://togithub.com/bufbuild/connect-go/compare/v1.4.0...v1.4.1)

<!-- Release notes generated using configuration in .github/release.yml
at main -->

#### What's Changed

##### Bugfixes

- Ensure server reflection can always access protobuf descriptors by
[@&#8203;joshcarp](https://togithub.com/joshcarp) in
[https://github.com/bufbuild/connect-go/pull/418](https://togithub.com/bufbuild/connect-go/pull/418)
- Don't clobber custom User-Agents by
[@&#8203;akshayjshah](https://togithub.com/akshayjshah) in
[https://github.com/bufbuild/connect-go/pull/423](https://togithub.com/bufbuild/connect-go/pull/423)

**Full Changelog**:
bufbuild/connect-go@v1.4.0...v1.4.1

###
[`v1.4.0`](https://togithub.com/bufbuild/connect-go/releases/tag/v1.4.0)

[Compare
Source](https://togithub.com/bufbuild/connect-go/compare/v1.3.2...v1.4.0)

<!-- Release notes generated using configuration in .github/release.yml
at main -->

#### What's Changed

##### Enhancements

- Improve panic message on invalid handler returns by
[@&#8203;akshayjshah](https://togithub.com/akshayjshah) in
[https://github.com/bufbuild/connect-go/pull/415](https://togithub.com/bufbuild/connect-go/pull/415)
- Add support for Connect-Protocol-Version header by
[@&#8203;akshayjshah](https://togithub.com/akshayjshah) in
[https://github.com/bufbuild/connect-go/pull/416](https://togithub.com/bufbuild/connect-go/pull/416)

#### Migration Notes

As a consequence of
[https://github.com/bufbuild/connect-go/pull/416](https://togithub.com/bufbuild/connect-go/pull/416),
`connect-go` servers exposed to web browsers may need to amend their
CORS configuration to add `Connect-Protocol-Version` to
`Access-Control-Allow-Headers`. The [pull request
description](https://togithub.com/bufbuild/connect-go/pull/416) explains
the motivation for this additional header.

**Full Changelog**:
bufbuild/connect-go@v1.3.2...v1.4.0

###
[`v1.3.2`](https://togithub.com/bufbuild/connect-go/releases/tag/v1.3.2)

[Compare
Source](https://togithub.com/bufbuild/connect-go/compare/v1.3.1...v1.3.2)

<!-- Release notes generated using configuration in .github/release.yml
at main -->

#### What's Changed

##### Bugfixes

- Send gRPC error metadata only as HTTP trailers by
[@&#8203;akshayjshah](https://togithub.com/akshayjshah) in
[https://github.com/bufbuild/connect-go/pull/410](https://togithub.com/bufbuild/connect-go/pull/410)

**Full Changelog**:
bufbuild/connect-go@v1.3.1...v1.3.2

</details>

---

### Configuration

📅 **Schedule**: Branch creation - At any time (no schedule defined),
Automerge - At any time (no schedule defined).

🚦 **Automerge**: Enabled.

♻ **Rebasing**: Whenever PR becomes conflicted, or you tick the
rebase/retry checkbox.

🔕 **Ignore**: Close this PR and you won't be reminded about this update
again.

---

- [ ] <!-- rebase-check -->If you want to rebase/retry this PR, check
this box

---

This PR has been generated by [Mend
Renovate](https://www.mend.io/free-developer-tools/renovate/). View
repository job log
[here](https://app.renovatebot.com/dashboard#github/open-feature/flagd).

<!--renovate-debug:eyJjcmVhdGVkSW5WZXIiOiIzNC45Ny42IiwidXBkYXRlZEluVmVyIjoiMzQuOTcuNiJ9-->

Co-authored-by: renovate[bot] <29139614+renovate[bot]@users.noreply.github.com>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Handler returning nil response results in cryptic stack trace.
4 participants