Skip to content

Conversation

EricIO
Copy link
Contributor

@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.

@EricIO EricIO requested review from miekg and tmthrgd as code owners August 6, 2024 08:19
@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 EricIO force-pushed the annotate_unpack_errors branch from da17676 to 8ba105b Compare August 15, 2024 06:00
@EricIO
Copy link
Contributor 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
Contributor Author

EricIO commented Sep 4, 2024

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

@EricIO
Copy link
Contributor Author

EricIO commented Nov 29, 2024

@miekg Small bump for this MR.

@EricIO
Copy link
Contributor Author

EricIO commented Jun 5, 2025

@miekg Hey do you think there is a possibility to merge this MR?

@miekg
Copy link
Owner

miekg commented Jun 19, 2025

I did not get the idea this was fully fleshed out

@EricIO
Copy link
Contributor Author

EricIO commented Jul 3, 2025

It should be complete for the unpack functions, perhaps the question is if there are more things were this could also be useful. But for our own use case this should do the job.

@miekg
Copy link
Owner

miekg commented Jul 9, 2025

ok, I'll likely fiddle with the exact wording for the errors, but merging

@miekg miekg merged commit 186ccfb into miekg:master Jul 9, 2025
4 checks 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.

2 participants