add constructor for error
This commit is contained in:
parent
f698687a2d
commit
3059a3b774
|
@ -12,6 +12,13 @@ pub struct Error {
|
|||
}
|
||||
|
||||
impl Error {
|
||||
pub fn new<E: std::error::Error + 'static>(message: String, source: E) -> Self {
|
||||
Self {
|
||||
message,
|
||||
source: Some(Box::new(source)),
|
||||
}
|
||||
}
|
||||
|
||||
fn wrap<E: std::error::Error + 'static>(value: E) -> Option<Box<dyn std::error::Error>> {
|
||||
Some(Box::new(value))
|
||||
}
|
||||
|
|
Loading…
Reference in a new issue