pub type Error = AlienError<ErrorData>;Expand description
Convenience alias representing a constructed AlienError with our ErrorData payload.
Aliased Type§
pub struct Error {
pub code: String,
pub message: String,
pub context: Option<Value>,
pub retryable: bool,
pub internal: bool,
pub http_status_code: Option<u16>,
pub source: Option<Box<AlienError>>,
pub error: Option<ErrorData>,
}Fields§
§code: StringA unique identifier for the type of error.
This should be a short, machine-readable string that can be used by clients to programmatically handle different error types. Examples: “NOT_FOUND”, “VALIDATION_ERROR”, “TIMEOUT”
message: StringHuman-readable error message.
This message should be clear and actionable for developers or end-users, providing context about what went wrong and potentially how to fix it.
context: Option<Value>Additional diagnostic information about the error context.
This optional field can contain structured data providing more details about the error, such as validation errors, request parameters that caused the issue, or other relevant context information.
retryable: boolIndicates whether the operation that caused the error should be retried.
When true, the error is transient and the operation might succeed
if attempted again. When false, retrying the same operation is
unlikely to succeed without changes.
internal: boolIndicates if this is an internal error that should not be exposed to users.
When true, this error contains sensitive information or implementation
details that should not be shown to end-users. Such errors should be
logged for debugging but replaced with generic error messages in responses.
http_status_code: Option<u16>HTTP status code for this error.
Used when converting the error to an HTTP response. If None, falls back to the error type’s default status code or 500.
source: Option<Box<AlienError>>The underlying error that caused this error, creating an error chain.
This allows for proper error propagation and debugging by maintaining the full context of how an error occurred through multiple layers of an application.
error: Option<ErrorData>The original error for pattern matching