mirror of
https://github.com/haraldh/chainerror.git
synced 2025-05-29 21:18:07 +02:00
more documentation and formatting
This commit is contained in:
parent
ed710fada3
commit
1654624c08
8 changed files with 50 additions and 39 deletions
|
@ -51,6 +51,10 @@ fn func1() -> ChainResult<(), Func1Error> {
|
|||
|
||||
fn main() {
|
||||
if let Err(e) = func1() {
|
||||
eprintln!("\nDebug Error {{:?}}:\n{:?}", e);
|
||||
|
||||
eprintln!("\nAlternative Debug Error {{:#?}}:\n{:#?}\n", e);
|
||||
|
||||
match e.kind() {
|
||||
Func1Error::Func2 => eprintln!("Main Error Report: func1 error calling func2"),
|
||||
Func1Error::IO(filename) => {
|
||||
|
@ -66,9 +70,5 @@ fn main() {
|
|||
let ioerror = e.downcast_ref::<io::Error>().unwrap();
|
||||
eprintln!("\nThe root cause was: std::io::Error: {:#?}", ioerror);
|
||||
}
|
||||
|
||||
eprintln!("\nDebug Error:\n{:?}", e);
|
||||
|
||||
eprintln!("\nAlternative Debug Error:\n{:#?}", e);
|
||||
}
|
||||
}
|
||||
|
|
|
@ -1,7 +1,7 @@
|
|||
pub mod mycrate {
|
||||
use std::error::Error as StdError;
|
||||
|
||||
use func2mod::{do_some_io, func2};
|
||||
use self::func2mod::{do_some_io, func2};
|
||||
|
||||
pub mod func2mod {
|
||||
use std::error::Error as StdError;
|
||||
|
|
|
@ -1,7 +1,6 @@
|
|||
pub mod mycrate {
|
||||
use std::io;
|
||||
|
||||
use chainerror::prelude::v1::*;
|
||||
use std::io;
|
||||
|
||||
fn do_some_io(_f: &str) -> std::result::Result<(), io::Error> {
|
||||
Err(io::Error::from(io::ErrorKind::NotFound))?;
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue