Skip to content

Commit

Permalink
Adding packet data to the debug message when packet decoding failed
Browse files Browse the repository at this point in the history
  • Loading branch information
Supereg committed Sep 24, 2020
1 parent 8ac003a commit 60b6a24
Showing 1 changed file with 3 additions and 2 deletions.
5 changes: 3 additions & 2 deletions src/MDNSServer.ts
Original file line number Diff line number Diff line change
Expand Up @@ -441,8 +441,9 @@ export class MDNSServer {
try {
packet = DNSPacket.decode(buffer);
} catch (error) {
debug("Received malformed packet from %s: %s", JSON.stringify(rinfo), error.message);
debug(error.stack); // might be a bit spammy, but not having the error cause when it's maybe needed is not better
debug("Received a malformed packet from %o on interface %s. This might or might not be a problem. " +
"Here is the received packet for debugging purposes '%s'. " +
"Packet decoding failed with %s", rinfo, name, buffer.toString("base64"), error.stack);
return;
}

Expand Down

0 comments on commit 60b6a24

Please sign in to comment.