filipegoncalves / rust-config

Configuration file library in Rust similar to C/C++'s libconfig
MIT License
20 stars 10 forks source link

add Error instance for ConfigError #2

Closed mathstuf closed 9 years ago

mathstuf commented 9 years ago

This would allow it to be used with try! in mixed contexts much easier.

filipegoncalves commented 9 years ago

Agreed. Have you implemented this? I would be happy to merge a pull request. Otherwise I can look at it soon.

mathstuf commented 9 years ago

I have a really crappy implementation. Mainly due to my inexperience with Rust so far. String::from_str and String::as_str being unstable doesn't help. I basically make a WrapConfigError with a string in it which stores the description string computed in From rather than in description itself.

mathstuf commented 9 years ago

Here is my instance for it. Not really clean, but I'm also using 1.1, so I can't use unstable features.

mathstuf commented 9 years ago

OK, I've cleaned it up considerably. Still needs an intermediate type to own the description though, AFAICT.

filipegoncalves commented 9 years ago

@mathstuf Sorry for the delay. I kind of let the project die a bit, but I want to get back to it. It looks good, can you do a pull request? Though it's kind of a hacky solution, in the short-term I'd say it's enough, we can think about a cleaner interface later (I need to get back on track with Rust).