← all modules

Sky.Core.Error

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 -> Error
  decode : String -> Error
  domain : 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 -> Error
  fromDomain : ErrorKind -> String -> DomainFailure -> Error
      An `Error` that carries a domain failure. The kind is required, so code
  invalidInput : String -> Error
  io : String -> Error
  isRetryable : Error -> Bool
      True when a retry of the same call can succeed. A domain failure's own
  kindLabel : ErrorKind -> String
  mkInfo : String -> ErrorInfo
  network : String -> Error
  notFound : Error
  permissionDenied : Error
  retryAfter : Error -> Maybe Int
      The retry delay in milliseconds that the error's domain failure names.
  timeout : Error
  toString : Error -> String
      Human-readable `<Kind>: <message>` form. Suitable for logs, toasts,
  unavailable : String -> Error
  unexpected : String -> Error
  withAttr : String -> String -> DomainFailure -> DomainFailure
      Add a string attribute. A key that is already present keeps its place and
  withDetails : ErrorDetails -> Error -> Error
  withMessage : String -> Error -> Error
  withRetryAfter : 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.