Re:Get familiar with workspaces
by philwelch on Monday April 11, 2022 @11:08PM
(#30998139)
I mostly agree, but I’m also comfortable using “panic” in an HTTP server to throw 500’s.
[ Parent
| on HN ]
Re:Get familiar with workspaces
by preseinger on Sunday April 17, 2022 @05:01AM
(#31059543)
Goodness, I hope not! This breaks all your downstream middleware and whatever business logic is invoked by your handlers. If you encounter a 500-worthy problem it's an `error` return like anything else.
`panic` is not for business logic.
> `panic` is not for business logic.
Neither are 500 responses. A perfect HTTP server never responds 500 and there aren't any situations I've ever encountered where there's any valuable error recovery or business logic left to be done once the server has run into a 500-worthy issue.
IIRC, the HTTP server in the Go standard library recovers panics and issues 500 responses, which is what I would expect it to do.
Re:Get familiar with workspaces
by preseinger on Tuesday April 26, 2022 @05:29PM
(#31173440)
500 maps to a set of business logic errors, sure. Why not?