diff options
| author | Matthew Collins <[email protected]> | 2018-02-27 17:52:35 +0000 |
|---|---|---|
| committer | Matthew Collins <[email protected]> | 2018-02-27 17:52:35 +0000 |
| commit | 96994649279e9e3ccb23986d8c49afde0af73798 (patch) | |
| tree | 0e4967e0718403b30b011a78f803dc45db7f07e2 /src/lib.rs | |
| parent | Add basic steam user accessor (diff) | |
| download | steamworks-rs-96994649279e9e3ccb23986d8c49afde0af73798.tar.xz steamworks-rs-96994649279e9e3ccb23986d8c49afde0af73798.zip | |
Improve error handling
Diffstat (limited to 'src/lib.rs')
| -rw-r--r-- | src/lib.rs | 11 |
1 files changed, 6 insertions, 5 deletions
@@ -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 { |