Migrated to using error_chain.

This commit is contained in:
Aaron Weiss 2017-06-20 14:54:06 -04:00
parent 1ca609331c
commit cc1aa5717e
No known key found for this signature in database
GPG key ID: 0237035D9BF03AE2
11 changed files with 103 additions and 64 deletions

View file

@ -3,10 +3,11 @@ use std::borrow::ToOwned;
use std::collections::HashMap;
use std::fs::File;
use std::io::prelude::*;
use std::io::{Error, ErrorKind, Result};
use std::io::{Error, ErrorKind};
use std::net::{SocketAddr, ToSocketAddrs};
use std::path::Path;
use serde_json;
use error::Result;
/// Configuration data.
#[derive(Clone, Deserialize, Serialize, Default, PartialEq, Debug)]
@ -71,7 +72,7 @@ impl Config {
Error::new(
ErrorKind::InvalidInput,
"Failed to decode configuration file.",
)
).into()
})
}
@ -85,7 +86,7 @@ impl Config {
"Failed to encode configuration file.",
)
})).as_bytes(),
)
).map_err(|e| e.into())
}
/// Determines whether or not the nickname provided is the owner of the bot.