Skip to content

Conversation

@frozenbonito
Copy link
Contributor

Added the ReportInternalErrors option to report internal errors.

close #59

@tomarrell
Copy link
Owner

Thanks a lot for the PR! I will have a look in more detail shortly, but looks good from a quick glance.

fnIdent, ok := call.Fun.(*ast.Ident)
if ok {
fnSig := pass.TypesInfo.ObjectOf(fnIdent).String()
pass.Reportf(tokenPos, "error should be unwrapped: sig: %s", fnSig)
Copy link
Owner

Choose a reason for hiding this comment

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

I think the error message here should be more along the lines of error should be wrapped as the purpose of this is to identify incorrectly unwrapped errors.

Suggested change
pass.Reportf(tokenPos, "error should be unwrapped: sig: %s", fnSig)
pass.Reportf(tokenPos, "package-internal error should be wrapped: sig: %s", fnSig)

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Thank you for your comment.
I have fixed the error messages.

Copy link
Owner

@tomarrell tomarrell left a comment

Choose a reason for hiding this comment

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

Just a couple of questions, thanks a lot! 😃

@frozenbonito frozenbonito force-pushed the add-option-for-reporting-internal-errors branch from 067f50b to e13f4da Compare March 11, 2025 16:53
@frozenbonito frozenbonito requested a review from tomarrell March 11, 2025 16:57
Copy link
Owner

@tomarrell tomarrell left a comment

Choose a reason for hiding this comment

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

Looks great, thanks a lot! Will soon cut a new release for these changes.

Cheers!

@tomarrell tomarrell merged commit 486d5bb into tomarrell:master Mar 11, 2025
1 check passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Option to enforce wrapping for errors returned from package-internal functions

2 participants