Module Twirp_core.Error_codes

Standard error codes for Twirp.

Also see https://twitchtv.github.io/twirp/docs/errors.html

type t =
  1. | Canceled
    (*

    The operation was cancelled.

    *)
  2. | Unknown
    (*

    An unknown error occurred. For example, this can be used when handling errors raised by APIs that do not return any error information.

    *)
  3. | Invalid_argument
    (*

    The client specified an invalid argument. This indicates arguments that are invalid regardless of the state of the system (i.e. a malformed file name, required argument, number out of range, etc.).

    *)
  4. | Malformed
    (*

    The client sent a message which could not be decoded. This may mean that the message was encoded improperly or that the client and server have incompatible message definitions.

    *)
  5. | Deadline_exceeded
    (*

    Operation expired before completion. For operations that change the state of the system, this error may be returned even if the operation has completed successfully (timeout).

    *)
  6. | Not_found
    (*

    Some requested entity was not found.

    *)
  7. | Bad_route
    (*

    The requested URL path wasn't routable to a Twirp service and method. This is returned by generated server code and should not be returned by application code (use " not_found " or " unimplemented " instead).

    *)
  8. | Already_exists
    (*

    An attempt to create an entity failed because one already exists.

    *)
  9. | Permission_denied
    (*

    The caller does not have permission to execute the specified operation. It must not be used if the caller cannot be identified (use " unauthenticated " instead).

    *)
  10. | Unauthenticated
    (*

    The request does not have valid authentication credentials for the operation.

    *)
  11. | Resource_exhausted
    (*

    Some resource has been exhausted or rate-limited, perhaps a per-user quota, or perhaps the entire file system is out of space.

    *)
  12. | Failed_precondition
    (*

    The operation was rejected because the system is not in a state required for the operation's execution. For example, doing an rmdir operation on a directory that is non-empty, or on a non-directory object, or when having conflicting read-modify-write on the same resource.

    *)
  13. | Aborted
    (*

    The operation was aborted, typically due to a concurrency issue like sequencer check failures, transaction aborts, etc.

    *)
  14. | Out_of_range
    (*

    The operation was attempted past the valid range. For example, seeking or reading past end of a paginated collection. Unlike " invalid_argument ", this error indicates a problem that may be fixed if the system state changes (i.e. adding more items to the collection). There is a fair bit of overlap between " failed_precondition " and " out_of_range ". We recommend using " out_of_range " (the more specific error) when it applies so that callers who are iterating through a space can easily look for an " out_of_range " error to detect when they are done.

    *)
  15. | Unimplemented
    (*

    The operation is not implemented or not supported/enabled in this service.

    *)
  16. | Internal
    (*

    When some invariants expected by the underlying system have been broken. In other words, something bad happened in the library or backend service. Twirp specific issues like wire and serialization problems are also reported as "internal" errors.

    *)
  17. | Unavailable
    (*

    The service is currently unavailable. This is most likely a transient condition and may be corrected by retrying with a backoff.

    *)
  18. | Dataloss
    (*

    The operation resulted in unrecoverable data loss or corruption.

    *)
val to_msg_and_code : t -> string * int

Convert to a precise message and an http code

val to_descr : t -> string

Get doc about this error

val all : (t * int * string) list