Sky.Core.Error
Sky.Core.Error — the single unified error type used across the
Types
type alias ErrorInfo = { message : String , details : Maybe ErrorDetails }
type alias PanicInfo = { message : String , stack : List String }
type alias TypeInfo = { expected : String , actual : String }
type Error = Error ErrorKind ErrorInfo
type ErrorKind = Io | Network | Ffi | Decode | Timeout | NotFound | PermissionDenied | InvalidInput | Conflict | Unavailable | Unexpected
type ErrorDetails = FfiPanic PanicInfo | TypeMismatch TypeInfo | HttpStatus Int | JsonDecode String | Custom String | Domain DomainFailure
type DomainFailure
Values
conflict : String -> Errordecode : String -> Errordomain : Error -> Maybe String
The domain of the failure an error carries (`Just "ai"`), or `Nothing`
failure : String -> String -> DomainFailure
A domain failure with its domain and code. It is not retryable, has no
failureAttr : String -> DomainFailure -> Maybe String
The value of one attribute.
failureAttrs : DomainFailure -> List ( String, String )
Every attribute, in the order they were added.
failureCode : DomainFailure -> String
The failure's stable code inside its domain, for example `"Overloaded"`.
failureDomain : DomainFailure -> String
The failure's domain, for example `"ai"`.
failureOf : Error -> Maybe DomainFailure
The domain failure an error carries, if any.
failureRetryAfter : DomainFailure -> Maybe Int
The retry delay in milliseconds, when the failure names one.
failureRetryable : DomainFailure -> Bool
Whether a retry of the same call can succeed.
ffi : String -> ErrorfromDomain : ErrorKind -> String -> DomainFailure -> Error
An `Error` that carries a domain failure. The kind is required, so code
invalidInput : String -> Errorio : String -> ErrorisRetryable : Error -> Bool
True when a retry of the same call can succeed. A domain failure's own
kindLabel : ErrorKind -> StringmkInfo : String -> ErrorInfonetwork : String -> ErrornotFound : ErrorpermissionDenied : ErrorretryAfter : Error -> Maybe Int
The retry delay in milliseconds that the error's domain failure names.
timeout : ErrortoString : Error -> String
Human-readable `<Kind>: <message>` form. Suitable for logs, toasts,
unavailable : String -> Errorunexpected : String -> ErrorwithAttr : String -> String -> DomainFailure -> DomainFailure
Add a string attribute. A key that is already present keeps its place and
withDetails : ErrorDetails -> Error -> ErrorwithMessage : String -> Error -> ErrorwithRetryAfter : Int -> DomainFailure -> DomainFailure
Set the delay, in milliseconds, after which a retry may succeed (a
withRetryable : Bool -> DomainFailure -> DomainFailure
Set whether a retry of the same call can succeed.