Module std::error [] [src]

Traits for working with Errors.

The Error trait

Error is a trait representing the basic expectations for error values, i.e. values of type E in Result<T, E>. At a minimum, errors must provide a description, but they may optionally provide additional detail (via Display) and cause chain information:

use std::fmt::Display;

trait Error: Display {
    fn description(&self) -> &str;

    fn cause(&self) -> Option<&Error> { None }
}

The cause method is generally used when errors cross "abstraction boundaries", i.e. when a one module must report an error that is "caused" by an error from a lower-level module. This setup makes it possible for the high-level module to provide its own errors that do not commit to any particular implementation, but also reveal some of its implementation for debugging via cause chains.

Reexports

use core::prelude::v1::*;
use any::TypeId;
use boxed::Box;
use convert::From;
use fmt::{self, Debug, Display};
use marker::{Send, Sync, Reflect};
use mem::transmute;
use num;
use option::Option::{self, Some, None};
use result::Result::{self, Ok, Err};
use raw::TraitObject;
use str;
use string::{self, String};

Traits

Error

Base functionality for all errors in Rust.