Skip to content

Commit

Permalink
Fix example of using TracedError with error kind pattern
Browse files Browse the repository at this point in the history
  • Loading branch information
yaahc committed Mar 13, 2020
1 parent 12fde2d commit fe21f92
Showing 1 changed file with 15 additions and 0 deletions.
15 changes: 15 additions & 0 deletions tracing-error/src/error.rs
Original file line number Diff line number Diff line change
Expand Up @@ -17,11 +17,26 @@ struct Erased;
///
/// ```rust,compile_fail
/// #[derive(Debug, thiserror::Error)]
/// enum Kind {
/// // ...
/// }
///
/// #[derive(Debug)]
/// pub struct Error {
/// source: TracedError<Kind>,
/// backtrace: Backtrace,
/// }
///
/// impl std::error::Error for Error {
/// fn source(&self) -> Option<&(dyn std::error::Error + 'static)> {
/// self.source.source()
/// }
///
/// fn backtrace(&self) -> Option<&Backtrace> {
/// Some(&self.backtrace)
/// }
/// }
///
/// impl fmt::Display for Error {
/// fn fmt(&self, fmt: &mut fmt::Formatter<'_>) -> fmt::Result {
/// fmt::Display::fmt(&self.source, fmt)
Expand Down

0 comments on commit fe21f92

Please sign in to comment.