-
Notifications
You must be signed in to change notification settings - Fork 33
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
refactor/lib: prepare for library support
Pull request: #2 Approved by: MichaelHirn
- Loading branch information
Showing
18 changed files
with
337 additions
and
105 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,42 @@ | ||
//! Defines the general set of error types in Collenchyma. | ||
use std::{error, fmt}; | ||
|
||
#[derive(Debug)] | ||
/// Defines the set of available Collenchyma error types. | ||
pub enum Error { | ||
/// Failure related to the Framework implementation. | ||
Framework(::framework::Error), | ||
/// Failure related to the SharedMemory. | ||
SharedMemory(::shared_memory::Error), | ||
/// Failure realted to an Library(Operation). | ||
Operation(::libraries::Error), | ||
} | ||
|
||
impl fmt::Display for Error { | ||
fn fmt(&self, f: &mut fmt::Formatter) -> fmt::Result { | ||
match *self { | ||
Error::Framework(ref err) => write!(f, "Framwork error: {}", err), | ||
Error::SharedMemory(ref err) => write!(f, "SharedMemory error: {}", err), | ||
Error::Operation(ref err) => write!(f, "Library/Operation error: {}", err), | ||
} | ||
} | ||
} | ||
|
||
impl error::Error for Error { | ||
fn description(&self) -> &str { | ||
match *self { | ||
Error::Framework(ref err) => err.description(), | ||
Error::SharedMemory(ref err) => err.description(), | ||
Error::Operation(ref err) => err.description(), | ||
} | ||
} | ||
|
||
fn cause(&self) -> Option<&error::Error> { | ||
match *self { | ||
Error::Framework(ref err) => Some(err), | ||
Error::SharedMemory(ref err) => Some(err), | ||
Error::Operation(ref err) => Some(err), | ||
} | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -74,3 +74,4 @@ pub mod libraries; | |
pub mod shared_memory; | ||
pub mod operation; | ||
pub mod binary; | ||
pub mod error; |
Oops, something went wrong.