Comments (4)
from hickory-dns.
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
fn load_zone(zone_dir: &Path, zone: &ZoneConfig) -> Result<Authority, String> {
let zone_name: Name = zone.get_zone().expect("bad zone name");
should become
fn load_zone(zone_dir: &Path, zone: &ZoneConfig) -> Result<Authority, String> {
let zone_name: Name = try!(zone.get_zone().chain_err("bad zone name"));
but it doesn't compile, even with use trust_dns::error::ParseChainErr
added.
p.s. I'm commenting here rather than raising a new issue because I'm not sure whether this is as-designed or not.
from hickory-dns.
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 the lib.rs
and the trust_dns::server
module.
Now, we could clean this up in named.rs
for 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 with map_err(...)
. Even though I've changed everything to use error-chain everywhere, I haven't actually used chain_err(...)
enough to know exactly what the issue is there.
from hickory-dns.
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.
from hickory-dns.
Related Issues (20)
- Failing to read "_acme-challenge" TXT record HOT 3
- Debug assert triggered: record types do not match, DNSKEY <> Some(Unknown(48)) HOT 4
- do not leak and requested domain to the log HOT 21
- trust-dns quic client can not querry trust-dns quic server HOT 11
- RecordType does not implement Deserialize... but it does? HOT 3
- How to run async dynamic update with DNS SEC? HOT 2
- `proto::op::Message` can panic when `dnssec` is not enabled no debug builds HOT 3
- Panic: "bad character in CAA issuer value" HOT 2
- Prometheus metrics HOT 4
- `ClientConfig` and `RootCertStore` improvements HOT 4
- trust-dns only warns instead of returning Err when it has no nameservers listed in /etc/resolv.conf HOT 6
- read_system_conf returns different Error types on unix vs windows HOT 1
- Unable to build without linking against libssl/libcrypt HOT 2
- Revisit maximum request sizes in TCP, DoT, DoH, and DoQ implementations
- Axfr and AxfrStream issues with big zones HOT 3
- Sync client hang HOT 4
- Hickory DNS rebranding HOT 9
- How can AsyncClient be used with UdpStream? HOT 10
- Use AsyncClient across multiple tokio async tasks HOT 2
- Update ring to support s390x and ppc64el HOT 12
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from hickory-dns.