[−][src]Module dangerous::error
Error support
- If you want the fastest error which has no debugging information,
Invalid
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 featurefull-context
is enabled,Expected
usesFullContextStack
,RootContextStack
if not. - If you require more verbosity, consider creating custom
Context
s before jumping to custom errors. If you do require a custom error, implementing it is easy enough. Just implementFromContext
andFrom
forExpectedValue
,ExpectedLength
andExpectedValid
and you'll be on your merry way. Additionally implementErrorDetails
to support lovely error printing andToRetryRequirement
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
Expected | A catch-all error for all expected errors supported in this crate. |
ExpectedContext | A sealed expected context. |
ExpectedLength | An error representing a failed requirement for a length of |
ExpectedValid | An error representing a failed requirement for a valid |
ExpectedValue | An error representing a failed exact value requirement of |
FullContextStack | full-context A context stack that contains all contexts collected. |
Invalid |
|
RetryRequirement | An indicator of how many bytes are required to continue processing input. |
RootContextStack | A context stack that only contains the root |
Traits
Context | The base context surrounding an error. |
ContextStack | A walkable stack of contexts collected from an error. |
ContextStackBuilder | A |
Error | Convenience trait requiring both |
ErrorDetails | The required details around an error to produce a verbose report on what went wrong when processing input. |
FromContext | Implemented for errors that collect contexts. |
FromExpected | Convenience trait requiring |
ToRetryRequirement | Implemented for errors that return input requirements. |
Type Definitions
ContextStackWalker | A dynamic function for walking a context stack. |