-
Notifications
You must be signed in to change notification settings - Fork 193
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
apm.Error implements error interface #391
Comments
@psrebniak apm.Error wasn't designed to be passed around as an |
Ok, so let's define two usecases:
In first case, all errors should be handled If we could pass We use own package to check type of error, if it is We define errors inside |
OK, so in summary you would like to be able to defer the decision to call To answer your question "Is there any reason, why Error does not implement error interface?", only that I had not yet considered this scenario. Your suggestion seems reasonable to me.
That would be great, I'd be happy to review your pull request. One request I have is that the type causer interface {
Cause() error
} This would enable the handling code to inspect the underlying error. At the moment, neither |
Ok, should I keep original error in |
I agree, putting it directly in Error seems best. |
…rror-interface #391; implement error interface
Is your feature request related to a problem? Please describe.
At the moment there is no possibility to pass Error as error interface.
We have to redeclare type as
type ApmError apm.Error
and define methods there.Describe the solution you'd like
func (e *Error) Error() string
should be implementedIs there any reason, why Error does not implement error interface?
I can prepare pull request for that feature if you're interested in.
The text was updated successfully, but these errors were encountered: