mirror of
https://github.com/haraldh/chainerror.git
synced 2025-01-31 00:56:41 +01:00
chore: remove more Chain..
occurences
Signed-off-by: Harald Hoyer <harald@hoyer.xyz>
This commit is contained in:
parent
cacfb37d44
commit
cb2e1509e5
12
src/lib.rs
12
src/lib.rs
|
@ -111,9 +111,9 @@ impl<T: 'static + Display + Debug> Error<T> {
|
||||||
/// # derive_str_context!(FooError);
|
/// # derive_str_context!(FooError);
|
||||||
/// # let err = ChainError::new(String::new(), None, None);
|
/// # let err = ChainError::new(String::new(), None, None);
|
||||||
/// // Instead of writing
|
/// // Instead of writing
|
||||||
/// err.find_cause::<ChainError<FooError>>();
|
/// err.find_cause::<chainerror::Error<FooError>>();
|
||||||
///
|
///
|
||||||
/// // leave out the ChainError<FooError> implementation detail
|
/// // leave out the chainerror::Error<FooError> implementation detail
|
||||||
/// err.find_chain_cause::<FooError>();
|
/// err.find_chain_cause::<FooError>();
|
||||||
/// ```
|
/// ```
|
||||||
#[inline]
|
#[inline]
|
||||||
|
@ -134,13 +134,13 @@ impl<T: 'static + Display + Debug> Error<T> {
|
||||||
/// # derive_str_context!(FooErrorKind);
|
/// # derive_str_context!(FooErrorKind);
|
||||||
/// # let err = ChainError::new(String::new(), None, None);
|
/// # let err = ChainError::new(String::new(), None, None);
|
||||||
/// // Instead of writing
|
/// // Instead of writing
|
||||||
/// err.find_cause::<ChainError<FooErrorKind>>();
|
/// err.find_cause::<chainerror::Error<FooErrorKind>>();
|
||||||
/// // and/or
|
/// // and/or
|
||||||
/// err.find_chain_cause::<FooErrorKind>();
|
/// err.find_chain_cause::<FooErrorKind>();
|
||||||
/// // and/or
|
/// // and/or
|
||||||
/// err.find_cause::<FooErrorKind>();
|
/// err.find_cause::<FooErrorKind>();
|
||||||
///
|
///
|
||||||
/// // leave out the ChainError<FooErrorKind> implementation detail
|
/// // leave out the chainerror::Error<FooErrorKind> implementation detail
|
||||||
/// err.find_kind_or_cause::<FooErrorKind>();
|
/// err.find_kind_or_cause::<FooErrorKind>();
|
||||||
/// ```
|
/// ```
|
||||||
#[inline]
|
#[inline]
|
||||||
|
@ -192,7 +192,7 @@ impl<T: 'static + Display + Debug> Error<T> {
|
||||||
/// # }
|
/// # }
|
||||||
/// # }
|
/// # }
|
||||||
///
|
///
|
||||||
/// fn func1() -> ChainResult<(), Func1ErrorKind> {
|
/// fn func1() -> chainerror::Result<(), Func1ErrorKind> {
|
||||||
/// func2().context(Func1ErrorKind::Func2)?;
|
/// func2().context(Func1ErrorKind::Func2)?;
|
||||||
/// do_some_io().context(Func1ErrorKind::IO("bar.txt".into()))?;
|
/// do_some_io().context(Func1ErrorKind::IO("bar.txt".into()))?;
|
||||||
/// Ok(())
|
/// Ok(())
|
||||||
|
@ -559,7 +559,7 @@ where
|
||||||
/// # }
|
/// # }
|
||||||
/// derive_str_context!(Func2Error);
|
/// derive_str_context!(Func2Error);
|
||||||
///
|
///
|
||||||
/// fn func2() -> ChainResult<(), Func2Error> {
|
/// fn func2() -> chainerror::Result<(), Func2Error> {
|
||||||
/// let filename = "foo.txt";
|
/// let filename = "foo.txt";
|
||||||
/// do_some_io().context(Func2Error(format!("Error reading '{}'", filename)))?;
|
/// do_some_io().context(Func2Error(format!("Error reading '{}'", filename)))?;
|
||||||
/// Ok(())
|
/// Ok(())
|
||||||
|
|
|
@ -1,4 +1,4 @@
|
||||||
use chainerror::prelude::v1::*;
|
use chainerror::ResultTrait;
|
||||||
|
|
||||||
#[test]
|
#[test]
|
||||||
fn test_basic() {
|
fn test_basic() {
|
||||||
|
@ -19,7 +19,6 @@ fn test_basic() {
|
||||||
|
|
||||||
if let Err(e) = process_config_file() {
|
if let Err(e) = process_config_file() {
|
||||||
let os_notfound_error = std::io::Error::from_raw_os_error(2);
|
let os_notfound_error = std::io::Error::from_raw_os_error(2);
|
||||||
eprintln!("Error:\n{:?}", e);
|
|
||||||
let s = format!("{:?}", e);
|
let s = format!("{:?}", e);
|
||||||
let lines = s.lines().collect::<Vec<_>>();
|
let lines = s.lines().collect::<Vec<_>>();
|
||||||
assert_eq!(lines.len(), 5);
|
assert_eq!(lines.len(), 5);
|
||||||
|
|
|
@ -1,4 +1,4 @@
|
||||||
use chainerror::prelude::v1::*;
|
use chainerror::ResultTrait;
|
||||||
use std::error::Error;
|
use std::error::Error;
|
||||||
use std::io;
|
use std::io;
|
||||||
|
|
||||||
|
|
Loading…
Reference in a new issue