package ocaml-protoc-plugin

  1. Overview
  2. Docs
type error = [
  1. | `Premature_end_of_input
  2. | `Unknown_field_type of int
  3. | `Wrong_field_type of string * Ocaml_protoc_plugin__.Field.t
  4. | `Illegal_value of string * Ocaml_protoc_plugin__.Field.t
  5. | `Unknown_enum_value of int
  6. | `Oneof_missing
  7. | `Required_field_missing of int * string
]
exception Error of error
type 'a t = ('a, error) Stdlib.result
val raise : error -> 'a

Raise error as an exception of type Result.Error

val catch : (unit -> 'a) -> ('a, [> error ]) Stdlib.result

catch f catches any exception of type Result.Error raised and returns a result type

val (>>|) : 'a t -> ('a -> 'b) -> 'b t

Monadic map

val (>>=) : 'a t -> ('a -> 'b t) -> 'b t

Monadoc bind

val return : 'a -> 'a t

Monadic return

val fail : error -> 'a t

Create the error state

val get : msg:string -> 'a t -> 'a

Get the value or fail with the given message

val pp_error : Stdlib.Format.formatter -> error -> unit

Pretty printer of the error type

val show_error : error -> string

Create a string representation of error

val pp : (Stdlib.Format.formatter -> 'a -> unit) -> Stdlib.Format.formatter -> ('a, [< error ]) Stdlib.result -> unit

Prettyprinter