Replies: 1 comment 1 reply
-
I think you make a pretty convincing argument.
Do you have a source for this? |
Beta Was this translation helpful? Give feedback.
1 reply
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
-
From discussion on #302
Until recently we have avoided
panic
s in go-nitro, preferring instead to return and handleerror
s in all cases.This is tedious, and the tedium both slows development and potentially adds friction to certain function calls (ie,
x := makeSomething()
is a lot more compact thanx, err := makeSomething() + errorHandling
). Go language design people are pretty explicit about this being a feature rather than a bug: error conditions should be explicitly handled rather than glossed over.But... in some cases like:
the overhead of properly bubbling and handling these errors is probably not worth the effort. The alternative to a
error
ispanic
, which itself bubbles up the call stack and halts the program if unhandled.As things stand, there is no panic handling in go-nitro. It is considered impolite for
panic
s to escape a package / module.Instead an error condition in go-nitro should (probably) cause a shut-down of the go-nitro client / engine, alert the consuming application, and log this event.
Something approximating:
could be a suitable panic-boundary.
Beta Was this translation helpful? Give feedback.
All reactions