package ppx_factory

  1. Overview
  2. Docs

Source file loc_err.ml

1
2
3
4
5
6
7
8
9
10
11
12
13
14
type t =
  { loc : Location.t
  ; msg : string
  }

let msg t = t.msg

let as_result ~loc ~msg = Error {loc; msg}

let raise_ {loc; msg} = Raise.errorf ~loc "%s" msg

let ok_or_raise = function
  | Ok x -> x
  | Error err -> raise_ err
OCaml

Innovation. Community. Security.