Crate tectonic_errors
source ·Expand description
Generic error handling for Tectonic.
This crate provides a generic boxed error type, plus supporting utilities. In particular:
- The basic
Error
type is ananyhow
1.x boxed Error - The
atry!
macro allows simple structured annotations to be added to?
operations - The
a_ok_or!
macro allows for annotations toOption::ok_or_else
calls.
Re-exports
pub use anyhow;
Modules
- A “prelude” module providing a collection of useful names, without causing compiler complaints about the ones you don’t use.
Macros
- “annotated ok_or” — like
Option::ok_or_else()?
, but with the ability to add extended context to the error. This yields anAnnotatedMessage
as its error type. - “Annotated try” — like
try!
, but with the ability to add extended context to the error message. This tries to provide a bit more syntactic sugar than anyhow’swith_context()
, and it supports our AnnotatedMessage context type.
Structs
- A simple annotated message that can be attached to errors using the
anyhow::Context
methods, or be used as an error type itself. The recommended way to use this for error context is usingatry!
or related macros. - The generic error type, for complex operations that can fail for a wide range of reasons. This type is a reexport of the
anyhow
1.x series Error type.
Type Definitions
- A preloaded result type where the error type is our generic error type.
Result<T, Error>