package ppx_factory

  1. Overview
  2. Docs
type t

Type for located errors

val msg : t -> string

Return the message for the given located error

val as_result : loc:Ppxlib.Location.t -> msg:string -> ('a, t) Stdlib.result

Return a located error with the given loc and error message wrapped in a result's Error.

  • parameter loc

    the precise location of the unhandled part of the type declaration AST node. Should be more accurate than the loc provided by ppxlib to the generator function.

  • parameter msg

    the message to display when raising this error

val raise_ : t -> 'a

Raise the given located error using Raise.errorf

val ok_or_raise : ('a, t) Stdlib.result -> 'a

Return the value or raise the error from the given result