solana_libra_failure_ext/
lib.rs

1// Copyright (c) The Libra Core Contributors
2// SPDX-License-Identifier: Apache-2.0
3
4//! A common error handling library for the Libra project.
5//!
6//! ## Usage
7//!
8//! // This crate must be imported as 'failure' in order to ensure the
9//! // procedural derive macro for the `Fail` trait can function properly.
10//! failure = { path = "../common/failure_ext", package = "failure_ext" }
11//! // Most of the types and macros you'll need can be found in the prelude.
12//! use failure::prelude::*;
13
14pub use failure::{
15    _core, bail, ensure, err_msg, format_err, AsFail, Backtrace, Causes, Compat, Context, Error,
16    Fail, ResultExt, SyncFailure,
17};
18
19// Custom error handling macros are placed in the failure_macros crate. Due to
20// the way intra-crate macro exports currently work, macros can't be exported
21// from anywhere but the top level when they are defined in the same crate.
22pub use failure_macros::bail_err;
23
24pub type Result<T> = ::std::result::Result<T, Error>;
25
26/// Prelude module containing most commonly used types/macros this crate exports.
27pub mod prelude {
28    pub use crate::Result;
29    pub use failure::{bail, ensure, err_msg, format_err, Error, Fail, ResultExt};
30    pub use failure_macros::bail_err;
31}