I work on a library that does catch panics from user code. It's a web framework, and catches panics in user request handlers to return a 500 error to the client. This error is explicitly not overridable (every other default error can be replaced, but not this one), since we don't want you to panic in the first place.
View all comments
Show parent comment
40
u/mathisntmathingsad Oct 17 '26
Yeah, the only reason you should try to catch a panic is if you're making something that calls user-provided code unavoidably (i.e. an async runtime)