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

Annotate unpack* function errors with where the error happened. #1590

Open
wants to merge 1 commit into
base: master
Choose a base branch
from

Conversation

EricIO
Copy link

@EricIO EricIO commented Aug 6, 2024

Here's a first stab at the code for #1576

This commit adds annotations to the error message when an error occurs during unpacking of a DNS message, the annotation will give detiail on where in the DNS message the unpacking error occured at. This helps to improve the debugability of such errors.

@miekg
Copy link
Owner

miekg commented Aug 13, 2024

this looks good, however a whole bunch of

= RUN   TestTsigErrorResponse
    tsig_test.go:69: question.Qclass: %!w(<nil>)
--- FAIL: TestTsigErrorResponse (0.00s)
=== RUN   TestTsigBadTimeResponse
    tsig_test.go:98: question.Qclass: %!w(<nil>)
--- FAIL: TestTsigBadTimeResponse (0.00s)
=== RUN   TestTsigErrors
    tsig_test.go:140: expected an error 'dns: bad time' but got 'question.Qclass: %!w(<nil>)'
--- FAIL: TestTsigErrors (0.00s)

is popping up in the tests....

@EricIO
Copy link
Author

EricIO commented Aug 15, 2024

this looks good, however a whole bunch of

= RUN   TestTsigErrorResponse
    tsig_test.go:69: question.Qclass: %!w(<nil>)
--- FAIL: TestTsigErrorResponse (0.00s)
=== RUN   TestTsigBadTimeResponse
    tsig_test.go:98: question.Qclass: %!w(<nil>)
--- FAIL: TestTsigBadTimeResponse (0.00s)
=== RUN   TestTsigErrors
    tsig_test.go:140: expected an error 'dns: bad time' but got 'question.Qclass: %!w(<nil>)'
--- FAIL: TestTsigErrors (0.00s)

is popping up in the tests....

Oops sorry forgot to add my latest changes...

This commit adds annotations to the error message when an error occurs
during unpacking of a DNS message, the annotation will give detiail on
where in the DNS message the unpacking error occured at. This helps to
improve the debugability of such errors.
@EricIO
Copy link
Author

EricIO commented Sep 4, 2024

@miekg Does it look better now on your end as well?

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.

2 participants