twitchtv / twirp

A simple RPC framework with protobuf service definitions
https://twitchtv.github.io/twirp/docs/intro.html
Apache License 2.0
7.19k stars 326 forks source link

twirp.Erroer interface #320

Closed marioizquierdo closed 3 years ago

marioizquierdo commented 3 years ago

Issue #300

Allow errors returned by service handlers to implement a different interface twirp.Erroer to be serialized as Twirp errors.

The interface doesn't need to be exported, but having it exported documents the alternative better and makes the option more explicit.

By submitting this pull request, I confirm that my contribution is made under the terms of the Apache 2.0 license.

cespare commented 3 years ago

Thanks for sending this PR! I will review this today.

rhysh commented 3 years ago

It's not clear to me that this new interface is required, or how the patterns it enables are different or better than what errors.As provides. I gave a specific example in https://github.com/twitchtv/twirp/issues/300#issuecomment-849826338.

marioizquierdo commented 3 years ago

closing in favor of #323 323