Closed ghost closed 6 years ago
To answer the question at the end, TOML is enabled by default, not JSON. That comment is a holdover from days past. I will correct it.
To the point: I don't recommend actually using that whole big config. It's just a concise way of showing all the fields. You should indeed not try to add certificates that don't exist. That would be bad.
There's also a side problem here which is that the error produced is confusing (it's not clear without looking at the implementation why you're getting a channel error). You can avoid this and get better error messages by using IrcReactor
(look at reactor.rs
for a version of simple.rs
with IrcReactor
).
This error using IrcReactor
(and it'll be even nicer if you use Display on the error (chain) instead):
thread 'main' panicked at 'called `Result::unwrap()` on an `Err` value: Io(Error { repr: Os { code: 2, message: "No such file or directory" } })', src/libcore/result.rs:906:4
stack backtrace:
0: std::sys::imp::backtrace::tracing::imp::unwind_backtrace
at src/libstd/sys/unix/backtrace/tracing/gcc_s.rs:49
1: std::sys_common::backtrace::_print
at src/libstd/sys_common/backtrace.rs:69
2: std::panicking::default_hook::{{closure}}
at src/libstd/sys_common/backtrace.rs:58
at src/libstd/panicking.rs:381
3: std::panicking::default_hook
at src/libstd/panicking.rs:397
4: std::panicking::begin_panic
at src/libstd/panicking.rs:577
5: std::panicking::begin_panic
at src/libstd/panicking.rs:538
6: std::panicking::try::do_call
at src/libstd/panicking.rs:522
7: std::panicking::try::do_call
at src/libstd/panicking.rs:498
8: <core::ops::range::Range<Idx> as core::fmt::Debug>::fmt
at src/libcore/panicking.rs:71
9: core::result::unwrap_failed
at /Users/travis/build/rust-lang/rust/src/libcore/macros.rs:23
10: <core::result::Result<T, E>>::unwrap
at /Users/travis/build/rust-lang/rust/src/libcore/result.rs:772
11: reactor::main
at examples/reactor.rs:19
12: panic_unwind::dwarf::eh::read_encoded_pointer
at src/libpanic_unwind/lib.rs:99
13: <std::rand::reader::ReaderRng<R> as rand::Rng>::fill_bytes
at src/libstd/panicking.rs:459
at src/libstd/panic.rs:361
at src/libstd/rt.rs:59
14: reactor::main::{{closure}}
Edit: I'll also be going through and adding more context with failure so that errors like this will specify, for example, what file was involved.
SOLUTION
Removing
cert_path
fromConfig.toml
solves everything!Head -> Wall... sorry
IGNORE ALL BELOW.
Hey,
consider the following config in
conf/config.toml
Now I tried to read that config via:
let client: IrcClient::new("./conf/config.toml").unwrap()
but got a nastyThen I tried it "manually", like so:
This does print the config, but fails again at the line:
let client = IrcClient::from_config(config).unwrap();
with
Any ideas what's going wrong here?
The whole stacktrace tells me no more interesting story:
(Line 15 being this one
let client = IrcClient::from_config(config).unwrap();
)I used the config from https://github.com/aatxe/irc main/readme-page
Also please note!
I only have that in my
Cargo.toml
irc = "0.13"
What I mean is, that on the main github page it says:
While in the code (
config.rs
) it says:Last sentence being Only json is available by default.
for
pub fn load<P: AsRef<Path>>(path: P) -> Result<Config> {
So is
TOML
available by default or must I useJSON
and enableTOML
by somefeature
?