Module Grpc.Status

type code =
  1. | OK
  2. | Cancelled
  3. | Unknown
  4. | Invalid_argument
  5. | Deadline_exceeded
  6. | Not_found
  7. | Already_exists
  8. | Permission_denied
  9. | Resource_exhausted
  10. | Failed_precondition
  11. | Aborted
  12. | Out_of_range
  13. | Unimplemented
  14. | Internal
  15. | Unavailable
  16. | Data_loss
  17. | Unauthenticated

code represents the valid gRPC status codes to respond with.

val int_of_code : code -> int

int_of_code c returns the corresponding integer status code for c.

val code_of_int : int -> code option

code_of_int i returns the corresponding code for i if it exists.

type t

t represents a full gRPC status, this includes code and optional message.

val v : ?message:string -> code -> t

v ~message code creates a new status with the given code and message.

val code : t -> code

code t returns the code associated with t.

val message : t -> string option

message t returns the message associated with t, if there is one.

val extract_status : H2.Headers.t -> t

extract_status headers returns the status embedded in the headers, or a default when the status is invalid or missing.