Skip to content

v5.7.0: Better panic handling

Compare
Choose a tag to compare
@spenczar spenczar released this 16 Apr 17:48

This release includes two changes to make panics easier to handle in Twirp servers, as well as a minor bug fix to correct #171.

First, panics are now propagated to Error hooks, allowing application owners to add instrumentation around them. Panics will be wrapped with as twirp.Errors, but will support a Cause() error method, so you can use github.com/pkg/errors to retrieve the root cause of errors in hooks. This was implemented in #160.

Second, Twirp servers now flush error responses when panicking, so that clients always get the message, and don't see a broken pipe if the server crashes due to the panic. In addition, Twirp servers now set Content-Length on all responses, so clients can be sure they have received the complete message. This was implemented in #168.

Finally, protoc-gen-twirp now generated correct code for service definitions with no methods. This was implemented in #171.