[PR #1785] [MERGED] resolver: use errors' Display impl #2608

Closed
opened 2026-03-16 10:47:07 +03:00 by kerem · 0 comments
Owner

📋 Pull Request Information

Original PR: https://github.com/hickory-dns/hickory-dns/pull/1785
Author: @hdhoang
Created: 10/1/2022
Status: Merged
Merged: 10/1/2022
Merged by: @djc

Base: mainHead: resolv-conf-error-Display


📝 Commits (1)

  • 299d25e resolver: use errors' Display impl

📊 Changes

1 file changed (+2 additions, -2 deletions)

View changed files

📝 crates/resolver/src/system_conf/unix.rs (+2 -2)

📄 Description

hi!

we had an error message saying InvalidOption(2) down this code path when using sentry's symbolicator. Since resolve_conf has a human-oriented message:

option at line 2 is not recognized

We would like to change these formatting to Display.

The crate stack was like: symbolicator -> reqwest -> trust-dns -> resolv_conf, so we needed to dig some layers down to reach the wrong thing in our resolv.conf files (vim helpfully highlight those too!).

after:

[crates/resolver/src/bin/test_wrong.rs:4] system_conf::parse_resolv_conf("search example.-.").err().unwrap() = Custom {
    kind: Other,
    error: "Error parsing resolv.conf: Malformed label: -",
}
[crates/resolver/src/bin/test_wrong.rs:7] system_conf::parse_resolv_conf("options unknown:1").err().unwrap() = Custom {
    kind: Other,
    error: "Error parsing resolv.conf: option at line 0 is not recognized",
}

before:

[crates/resolver/src/bin/test_wrong.rs:4] system_conf::parse_resolv_conf("search example.-.").err().unwrap() = Custom {
    kind: Other,
    error: "Error parsing resolv.conf: ProtoError { kind: Msg(\"Malformed label: -\") }",
}
[crates/resolver/src/bin/test_wrong.rs:7] system_conf::parse_resolv_conf("options unknown:1").err().unwrap() = Custom {
    kind: Other,
    error: "Error parsing resolv.conf: InvalidOption(0)",
}

If you find this helpful, and you're fine with it, please label hacktoberfest-accepted as well. Thanks in advance!


🔄 This issue represents a GitHub Pull Request. It cannot be merged through Gitea due to API limitations.

## 📋 Pull Request Information **Original PR:** https://github.com/hickory-dns/hickory-dns/pull/1785 **Author:** [@hdhoang](https://github.com/hdhoang) **Created:** 10/1/2022 **Status:** ✅ Merged **Merged:** 10/1/2022 **Merged by:** [@djc](https://github.com/djc) **Base:** `main` ← **Head:** `resolv-conf-error-Display` --- ### 📝 Commits (1) - [`299d25e`](https://github.com/hickory-dns/hickory-dns/commit/299d25e8a6c97224697a00dca124147e68fd0721) resolver: use errors' Display impl ### 📊 Changes **1 file changed** (+2 additions, -2 deletions) <details> <summary>View changed files</summary> 📝 `crates/resolver/src/system_conf/unix.rs` (+2 -2) </details> ### 📄 Description hi! we had an error message saying `InvalidOption(2)` down this code path when using sentry's symbolicator. Since `resolve_conf` has a human-oriented message: > option at line 2 is not recognized We would like to change these formatting to `Display`. The crate stack was like: symbolicator -> reqwest -> trust-dns -> resolv_conf, so we needed to dig some layers down to reach the wrong thing in our `resolv.conf` files (vim helpfully highlight those too!). after: ```rust [crates/resolver/src/bin/test_wrong.rs:4] system_conf::parse_resolv_conf("search example.-.").err().unwrap() = Custom { kind: Other, error: "Error parsing resolv.conf: Malformed label: -", } [crates/resolver/src/bin/test_wrong.rs:7] system_conf::parse_resolv_conf("options unknown:1").err().unwrap() = Custom { kind: Other, error: "Error parsing resolv.conf: option at line 0 is not recognized", } ``` before: ```rust [crates/resolver/src/bin/test_wrong.rs:4] system_conf::parse_resolv_conf("search example.-.").err().unwrap() = Custom { kind: Other, error: "Error parsing resolv.conf: ProtoError { kind: Msg(\"Malformed label: -\") }", } [crates/resolver/src/bin/test_wrong.rs:7] system_conf::parse_resolv_conf("options unknown:1").err().unwrap() = Custom { kind: Other, error: "Error parsing resolv.conf: InvalidOption(0)", } ``` If you find this helpful, and you're fine with it, please label `hacktoberfest-accepted` as well. Thanks in advance! --- <sub>🔄 This issue represents a GitHub Pull Request. It cannot be merged through Gitea due to API limitations.</sub>
kerem 2026-03-16 10:47:07 +03:00
Sign in to join this conversation.
No milestone
No project
No assignees
1 participant
Notifications
Due date
The due date is invalid or out of range. Please use the format "yyyy-mm-dd".

No due date set.

Dependencies

No dependencies set.

Reference
starred/hickory-dns#2608
No description provided.