Skip to content
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

Merged
merged 4 commits into from Jan 24, 2024

Conversation

efd6
Copy link
Collaborator

@efd6 efd6 commented Jan 18, 2024

@efd6 efd6 self-assigned this Jan 18, 2024
@efd6 efd6 added enhancement New feature or request Team:Security-External Integrations Label for the Security External Integrations team labels Jan 18, 2024
@efd6 efd6 marked this pull request as ready for review January 22, 2024 22:25
@efd6 efd6 requested a review from a team January 22, 2024 22:25
lib/errors.go Outdated
type nodeIDer interface {
NodeID() int64
}
nodeErr, ok := e.Err.(nodeIDer)
Copy link
Member

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?

Copy link
Collaborator Author

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 }:
Copy link
Member

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

Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

There is no spoon.

@efd6 efd6 merged commit 989f294 into dev Jan 24, 2024
4 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or request Team:Security-External Integrations Label for the Security External Integrations team
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

2 participants