aboutsummaryrefslogtreecommitdiff
path: root/src/lib.rs
diff options
context:
space:
mode:
authorMatthew Collins <[email protected]>2018-02-27 17:52:35 +0000
committerMatthew Collins <[email protected]>2018-02-27 17:52:35 +0000
commit96994649279e9e3ccb23986d8c49afde0af73798 (patch)
tree0e4967e0718403b30b011a78f803dc45db7f07e2 /src/lib.rs
parentAdd basic steam user accessor (diff)
downloadsteamworks-rs-96994649279e9e3ccb23986d8c49afde0af73798.tar.xz
steamworks-rs-96994649279e9e3ccb23986d8c49afde0af73798.zip
Improve error handling
Diffstat (limited to 'src/lib.rs')
-rw-r--r--src/lib.rs11
1 files changed, 6 insertions, 5 deletions
diff --git a/src/lib.rs b/src/lib.rs
index df42732..bd311d3 100644
--- a/src/lib.rs
+++ b/src/lib.rs
@@ -2,13 +2,12 @@
extern crate libc;
extern crate steamworks_sys as sys;
#[macro_use]
-extern crate error_chain;
+extern crate failure;
#[macro_use]
extern crate bitflags;
-pub mod error;
-pub use error::Result as SResult;
-use error::ErrorKind;
+mod error;
+pub use error::*;
mod utils;
pub use utils::*;
@@ -29,6 +28,8 @@ use std::fmt::{
};
use std::collections::HashMap;
+pub type SResult<T> = Result<T, SteamError>;
+
// A note about thread-safety:
// The steam api is assumed to be thread safe unless
// the documentation for a method states otherwise,
@@ -77,7 +78,7 @@ impl Client {
pub fn init() -> SResult<Client> {
unsafe {
if sys::SteamAPI_Init() == 0 {
- bail!(ErrorKind::InitFailed);
+ return Err(SteamError::InitFailed);
}
let client = sys::steam_rust_get_client();
let client = Arc::new(ClientInner {