Library-level error taxonomy used to classify Purify failures.
More...
#include <compare>
#include <cstdint>
#include <string_view>
#include <utility>
#include "purify/expected.hpp"
Go to the source code of this file.
|
| #define | PURIFY_DETAIL_CONCAT_IMPL(x, y) x##y |
| |
| #define | PURIFY_DETAIL_CONCAT(x, y) PURIFY_DETAIL_CONCAT_IMPL(x, y) |
| |
| #define | PURIFY_RETURN_IF_ERROR(expr, context) PURIFY_DETAIL_RETURN_IF_ERROR_IMPL(PURIFY_DETAIL_CONCAT(_purify_status_, __COUNTER__), expr, context) |
| | Evaluates an expected-like expression and returns the wrapped error on failure.
|
| |
| #define | PURIFY_ASSIGN_OR_RETURN(lhs, expr, context) PURIFY_DETAIL_ASSIGN_OR_RETURN_IMPL(PURIFY_DETAIL_CONCAT(_purify_result_, __COUNTER__), lhs, expr, context) |
| | Evaluates an expected-like expression, binds the value to lhs, and propagates errors.
|
| |
| #define | PURIFY_DETAIL_RETURN_IF_ERROR_IMPL(status_name, expr, context) |
| |
| #define | PURIFY_DETAIL_ASSIGN_OR_RETURN_IMPL(result_name, lhs, expr, context) |
| |
|
| enum class | purify::ErrorCategory : std::uint8_t { purify::Natural
, purify::Usage
, purify::Internal
} |
| | High-level classification for all recoverable Purify errors. More...
|
| |
| enum class | purify::ErrorCode : std::uint16_t {
purify::InvalidHex
, purify::InvalidHexLength
, purify::InvalidFixedSize
, purify::Overflow
,
purify::Underflow
, purify::NarrowingOverflow
, purify::DivisionByZero
, purify::BitIndexOutOfRange
,
purify::RangeViolation
, purify::EmptyInput
, purify::SizeMismatch
, purify::MissingValue
,
purify::InvalidSymbol
, purify::UnsupportedSymbol
, purify::UninitializedState
, purify::IndexOutOfRange
,
purify::InvalidDimensions
, purify::NonBooleanValue
, purify::EquationMismatch
, purify::BindingMismatch
,
purify::IoOpenFailed
, purify::IoWriteFailed
, purify::EntropyUnavailable
, purify::BackendRejectedInput
,
purify::HashToCurveExhausted
, purify::UnexpectedSize
, purify::GeneratorOrderCheckFailed
, purify::InternalMismatch
,
purify::TranscriptCheckFailed
} |
| | Machine-readable error codes shared across the library. More...
|
| |
◆ PURIFY_ASSIGN_OR_RETURN
Example: PURIFY_ASSIGN_OR_RETURN(auto secret, SecretKey::from_hex(hex), "caller:from_hex"); context is forwarded to unexpected_error().
Definition at line 338 of file error.hpp.
◆ PURIFY_DETAIL_ASSIGN_OR_RETURN_IMPL
| #define PURIFY_DETAIL_ASSIGN_OR_RETURN_IMPL |
( |
|
result_name, |
|
|
|
lhs, |
|
|
|
expr, |
|
|
|
context |
|
) |
| |
Value: auto result_name = (expr); \
if (!result_name.has_value()) \
return ::purify::unexpected_error(result_name.error(), context); \
lhs = std::move(*result_name)
Definition at line 346 of file error.hpp.
◆ PURIFY_DETAIL_CONCAT
◆ PURIFY_DETAIL_CONCAT_IMPL
| #define PURIFY_DETAIL_CONCAT_IMPL |
( |
|
x, |
|
|
|
y |
|
) |
| x##y |
◆ PURIFY_DETAIL_RETURN_IF_ERROR_IMPL
| #define PURIFY_DETAIL_RETURN_IF_ERROR_IMPL |
( |
|
status_name, |
|
|
|
expr, |
|
|
|
context |
|
) |
| |
Value: auto status_name = (expr); \
if (!status_name.has_value()) \
return ::purify::unexpected_error(status_name.error(), context)
Definition at line 341 of file error.hpp.
◆ PURIFY_RETURN_IF_ERROR
This is intended for Status-style propagation and may also be used with Result<T> when the value is intentionally discarded. context is forwarded to unexpected_error().
Definition at line 329 of file error.hpp.