-
Notifications
You must be signed in to change notification settings - Fork 7
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
lib,mito: add support for runtime error source location reporting #48
Conversation
lib/errors.go
Outdated
type nodeIDer interface { | ||
NodeID() int64 | ||
} | ||
nodeErr, ok := e.Err.(nodeIDer) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Would it make sense to use errors.As
here to check the tree in case any wrapped errors have a NodeID?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
We can't use errors.As
since it takes a concrete type. We can implement our own unwrap.
return node.NodeID(), true | ||
} | ||
switch x := err.(type) { | ||
case interface{ Unwrap() error }: |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I had no idea this was possible. TIL
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
There is no spoon.
Please take a look.
Best reviewed commit-wise.
tl;dr; https://github.com/elastic/mito/pull/48/files#diff-2a4e25714699ead9613fc2aadaae3b9d7d56b66f8578b27f46e03eec057aecd3
For elastic/beats#37304.