Module Awskit.Error Source Structured core error type.
Structured core AWS SDK errors.
Service packages preserve this value and add classifier helpers over it. Errors carry a structured kind plus an outer context stack. Human output is optimized for logs and CLI diagnostics; sexp output is optimized for structured debugging.
Application code should treat this module as a consumer API: inspect, classify, and print errors returned by Awskit operations.
The Producer submodule is the producer-side API for custom runtime authors, awskit service packages, runtime adapters, simulators, and tests that need to construct the shared opaque error type. It is not part of the application-facing consumer contract.
Opaque structured error. Use the accessors below for classification and diagnostics; use Producer only at implementation boundaries.
Raised by explicit _exn helpers. Non-exception APIs return t in their Error case.
Source type validation = private { field : string option ; message : string; } Caller/input validation error.
Source type credentials_error = private { source : string option ; message : string; } Credential discovery, loading, or validation failure.
Source type signing_error = private { message : string; } Source type endpoint_error = private { uri : string option ; message : string; } Endpoint resolution or validation failure.
Source type transport = private { message : string; retryable : bool; cause : string option ; } HTTP/runtime transport failure. cause is a compact runtime exception string when the adapter caught one.
Source type service = private { status : int; code : string option ; message : string option ; request_id : string option ; host_id : string option ; body : string option ; } AWS service error response.
Service values returned through public accessors and public diagnostics are safe for logs: secret-bearing headers are redacted and response bodies are replaced with a redaction marker. Use Unsafe_diagnostics when an implementor or test needs the raw service headers or body.
Source type body = private { message : string; limit : int64 option ; } Request or response body failure.
Source type decode = private { message : string; } Response metadata or payload decoding failure.
Source type timeout = private { operation : string option ; message : string; } Operation, connection, request, or response timeout.
Source type cancellation = private { reason : string option ; } Caller or runtime cancellation.
Source type retry_exhausted = private { attempts : int; max_attempts : int option ; last_error : t option ; message : string; } Retry policy exhaustion. last_error preserves the terminal failure when one is available.
Source type not_supported = private { feature : string option ; message : string; } Unsupported operation, feature, or runtime capability.
Source type operation = private { service : string option ; name : string; resource : string option ; } High-level SDK operation context.
Source type retry = private { attempt : int; max_attempts : int option ; reason : string; } Retry context attached to the returned final error.
Source type context = private | Message of string| Operation of operation | Retry of retry | Sexp of Base.Sexp.t Additional diagnostic context. Public accessors return redacted context.
Source type retry_class = | Retryable | Throttled | Auth | Conflict | Not_found | Fatal | Unknown Coarse caller-handling class used by retry policy and applications.
Return the redacted top-level error kind.
Source val context : t -> context listReturn the redacted context stack, newest context first.
Coarse retry/handling classification. retry_class aggregates Multiple errors by caller-handling priority: Auth > Throttled > Retryable > Conflict > Not_found > Fatal > Unknown. This means a retryable or throttled nested error can outrank a fatal nested validation/body/decode error.
Source val is_validation : t -> booltrue when t or a nested Multiple error contains validation failure.
Source val is_credentials : t -> booltrue when t or a nested Multiple error contains a credentials failure.
true when t or a nested Multiple error contains an endpoint failure.
true when t or a nested Multiple error contains a transport failure.
true when t or a nested Multiple error contains a timeout.
true when t or a nested Multiple error contains SDK-level cancellation. Runtime-native cancellation such as Lwt.Canceled may be preserved as an exception instead of converted to Cancelled.
Source val validation_field : t -> string option First validation field in t, if one is available.
Source val service_code : t -> string option First AWS service error code in t, if one is available.
Source val service_status : t -> int option First AWS service HTTP status in t, if one is available.
Render a redacted S-expression diagnostic.
Pretty-print a redacted human diagnostic.
Pretty-print the redacted S-expression diagnostic.
Source val to_string_hum : t -> stringRender a redacted human diagnostic string.
Source val to_sexp_string_hum : t -> stringRender a redacted S-expression diagnostic string.
Structural equality on error values.
Explicit escape hatch for raw diagnostic material.
Producer-side error constructors.