Something went wrong. Try again.
Dockerfile eDSL, combinators, printer and parser forked from gazagnaire.org/ocaml-dockerfile
Something went wrong. Try again.
1.5 kB · 39 lines
OCaml
at fixes
12345678910111213141516171819202122232425262728293031323334353637383940(** Dockerfile parse and interpretation errors.
A facade over {!Loc.Error}: it adds Dockerfile-specific error kinds, registers their printers, and re-exports the {!Loc.Error} surface so callers look in one place. Raising uses the shared {!Loc.Error.Error} exception. *)
type t = Loc.Error.t(** A located error; an alias of {!Loc.Error.t}. *)
type Loc.Error.kind += | Unsupported_instruction of string (** A Dockerfile keyword this library does not interpret. *)
val pp : t Fmt.t(** [pp] formats an error with its message and source location. *)
val to_string : t -> string(** [to_string e] formats [e] as a string. *)
(** {1 Builders and raisers} *)
val unsupported_instruction : Loc.Meta.t -> string -> t(** [unsupported_instruction meta kw] reports the unknown keyword [kw]. *)
val fail_unsupported_instruction : Loc.Meta.t -> string -> 'a(** [fail_unsupported_instruction meta kw] raises {!unsupported_instruction}. *)
val msg : Loc.Meta.t -> string -> t(** [msg meta s] is a located generic-message error. *)
val fail : Loc.Meta.t -> string -> 'a(** [fail meta s] raises {!msg}. *)
val failf : Loc.Meta.t -> ('a, Format.formatter, unit, 'b) format4 -> 'a(** [failf meta fmt] raises a located message formatted per [fmt]. *)
val relocate : Loc.Meta.t -> t -> t(** [relocate meta e] is [e] with its source location set to [meta]; used to stamp the offending line's position onto an error raised without one. *)