mirror of
https://github.com/hickory-dns/hickory-dns.git
synced 2026-04-25 11:15:54 +03:00
[GH-ISSUE #17] Convert all errors to use error-chain!{..} #311
Labels
No labels
blocked
breaking-change
bug
bug:critical
bug:tests
cleanup
compliance
compliance
compliance
crate:all
crate:client
crate:native-tls
crate:proto
crate:recursor
crate:resolver
crate:resolver
crate:rustls
crate:server
crate:util
dependencies
docs
duplicate
easy
easy
enhance
enhance
enhance
feature:dns-over-https
feature:dns-over-quic
feature:dns-over-tls
feature:dnsssec
feature:global_lb
feature:mdns
feature:tsig
features:edns
has workaround
ops
perf
platform:WASM
platform:android
platform:fuchsia
platform:linux
platform:macos
platform:windows
pull-request
question
test
tools
tools
trust
unclear
wontfix
No milestone
No project
No assignees
1 participant
Notifications
Due date
No due date set.
Dependencies
No dependencies set.
Reference
starred/hickory-dns#311
Loading…
Add table
Add a link
Reference in a new issue
No description provided.
Delete branch "%!s()"
Deleting a branch is permanent. Although the deleted branch may continue to exist for a short time before it actually gets removed, it CANNOT be undone in most cases. Continue?
Originally created by @bluejekyll on GitHub (Jun 15, 2016).
Original GitHub issue: https://github.com/hickory-dns/hickory-dns/issues/17
Originally assigned to: @bluejekyll on GitHub.
This should simplify error handling in Trust-DNS
@bluejekyll commented on GitHub (Jun 15, 2016):
https://users.rust-lang.org/t/announcing-error-chain-a-library-for-consistent-and-reliable-rust-error-handling/6133
@dckc commented on GitHub (Nov 6, 2016):
There are various uses of
.expect()in named.rs for things that are ordinary runtime error conditions (I/O Error loading the config file, bad zone name, ...). Shouldn't panic!() and hence .expect() be limited to bugs? i.e. design-time problems?I have to admit I can't figure out an alternative. I got the impression
should become
but it doesn't compile, even with
use trust_dns::error::ParseChainErradded.p.s. I'm commenting here rather than raising a new issue because I'm not sure whether this is as-designed or not.
@bluejekyll commented on GitHub (Nov 6, 2016):
I'll try and answer this question as best I can. First on the usage of expect/unwrap/panic in named. This is a top level binary. I've only expected it to be run through the main() method in binary form. To me, this means that given that any error in loading config will end up causing the application to exit abnormally, is fine. For anyone trying to use this as I library, where unwraps/expects should all be guarded against, I never intended them to call into
named.rs(is that even possible?), but through thelib.rsand thetrust_dns::servermodule.Now, we could clean this up in
named.rsfor the purposes of outputting cleaner errors to end users, that's probably a good goal at some point, but that hasn't been a top priority for me. I'd absolutely accept patches to clean that up!As to your issue with the
chain_err(...)conversion issue, the Result probably has to be mapped to a String withmap_err(...). Even though I've changed everything to use error-chain everywhere, I haven't actually usedchain_err(...)enough to know exactly what the issue is there.@dckc commented on GitHub (Nov 6, 2016):
OK, thanks for clarifying: panic!() from named should probably be cleaned up for nicer UX, though it's not critical. That's the way I look at it too.
Here's hoping for time to look into it further.