Module dangerous::error[][src]

Expand description

Error support.

  • If you want the fastest error which has no debugging information, Fatal or Invalid (retryable) has you covered.
  • If you want an error that is still designed to be fast, but also includes debugging information, Expected will meet your uh, expectations… If the feature full-backtrace is enabled, Expected uses FullBacktrace, RootBacktrace if not.
  • If you require more verbosity, consider creating custom Contexts before jumping to custom errors. If you do require a custom error, implementing it is easy enough. Just implement WithContext and From for ExpectedValue, ExpectedLength and ExpectedValid and you’ll be on your merry way. Additionally implement Details to support lovely error printing and ToRetryRequirement for streaming protocols.

Most of what dangerous supports out of the box is good to go. If you need to stretch out performance more, or provide additional functionality on what is provided, the error system should be flexible for those requirements. If it’s not, consider opening an issue.

Structs

CoreContext

A Context for core operations supported by dangerous.

Expected

An error that Details what went wrong while reading and may be retried.

ExpectedLength

An error representing a failed requirement for a length of Input.

ExpectedValid

An error representing a failed requirement for a valid Input.

ExpectedValue

An error representing a failed exact value requirement of Input.

ExternalContext

A Context for external operations.

Fatal

An error that has no details around what went wrong and cannot be retried.

FullBacktracealloc

A Backtrace that contains all Contexts collected.

Invalid

An error that has no details around what went wrong other than a RetryRequirement if the error is not fatal.

RetryRequirement

An indicator of how many bytes are required to continue processing input.

RootBacktrace

A Backtrace that only contains the root CoreContext.

Value

Value that was expected in an operation.

WithChildContext

Wraps an error making all contexts added to it children of the last operation.

Enums

CoreExpected

Core expectations used by dangerous.

CoreOperation

Core operations used by dangerous.

Length

Length that was expected in an operation.

Traits

Backtrace

Implemented for walkable stacks of Contexts collected from an error.

BacktraceBuilder

Implemented for Backtrace builders.

Context

Information surrounding an error.

Details

Required details around an error to produce a verbose report on what went wrong when processing input.

Error

Auto-trait for WithContext, ToRetryRequirement and From<Expected(Value/Length/Valid)>.

External

Implemented for errors that aren’t a first-class citizen to dangerous but wish to add additional information.

Operation

Operation that failed within a context.

ToRetryRequirement

Implemented for errors that return a RetryRequirement.

WithContext

Implemented for errors that collect Contexts.

Type Definitions

BacktraceWalker

A dynamic function for walking a context backtrace.