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

[BUG] Handle Error Produced by Handler #10

Closed
hadihammurabi opened this issue Oct 4, 2021 · 1 comment
Closed

[BUG] Handle Error Produced by Handler #10

hadihammurabi opened this issue Oct 4, 2021 · 1 comment
Labels
bug Something isn't working hacktoberfest

Comments

@hadihammurabi
Copy link
Contributor

Describe the bug
Handler has error as return value.
It can be nil if no errors.
Otherwise, error object if an error happen.

To Reproduce
Steps to reproduce the behavior:

  1. Create route and bind with handler
mux.Get("/", func(rw http.ResponseWriter, r *http.Request) error {
  return errors.New("something bad")
})
  1. The error is not handled.

Expected behavior
Should send HTTP response with error message and status.

@hadihammurabi hadihammurabi added bug Something isn't working hacktoberfest labels Oct 4, 2021
hadihammurabi added a commit that referenced this issue Oct 4, 2021
#10 Handles error return by request handler, send 500 status code and error message as response body.
@hadihammurabi
Copy link
Contributor Author

solved at #11

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working hacktoberfest
Projects
None yet
Development

No branches or pull requests

1 participant