mirror of
https://github.com/zap-proto/ocaml-rpc.git
synced 2026-10-30 15:04:28 +00:00
Makes it match the new package names, and also will shrink the diff for the Eio port.
31 lines
578 B
OCaml
31 lines
578 B
OCaml
(** Cap'n Proto exceptions. *)
|
|
|
|
type ty = [
|
|
| `Failed
|
|
| `Overloaded
|
|
| `Disconnected
|
|
| `Unimplemented
|
|
| `Undefined of int
|
|
]
|
|
|
|
type t = {
|
|
ty : ty;
|
|
reason : string;
|
|
}
|
|
|
|
let pp_ty f x =
|
|
Fmt.string f (match x with
|
|
| `Failed -> "Failed"
|
|
| `Overloaded -> "Overloaded"
|
|
| `Disconnected -> "Disconnected"
|
|
| `Unimplemented -> "Unimplemented"
|
|
| `Undefined x -> "Undefined:" ^ string_of_int x
|
|
)
|
|
|
|
let pp f ex =
|
|
Fmt.pf f "%a: %s" pp_ty ex.ty ex.reason
|
|
|
|
let v ?(ty = `Failed) reason = { ty; reason }
|
|
|
|
let cancelled = v "Cancelled"
|