this repo has no description
at main 71 lines 2.3 kB view raw
1type t 2 3val enable_missing_root_warning : bool ref 4 5val make : 6 ?suggestion:string -> 7 ('a, Format.formatter, unit, Location_.span -> t) format4 -> 8 'a 9 10val filename_only : 11 ?suggestion:string -> ('a, Format.formatter, unit, string -> t) format4 -> 'a 12 13val to_string : t -> string 14 15val raise_exception : t -> _ 16(** Raise a {!t} as an exception. Can be caught with {!catch} or 17 {!catch_errors_and_warnings}. *) 18 19val catch : (unit -> 'a) -> ('a, t) result 20 21type 'a with_warnings 22 23val raise_warning : ?non_fatal:bool -> t -> unit 24(** Raise a warning that need to be caught with [catch_warnings]. [non_fatal] is 25 [false] by default. *) 26 27val raise_warnings : 'a with_warnings -> 'a 28(** Accumulate warnings into a global variable. See [catch_warnings]. *) 29 30val catch_warnings : (unit -> 'a) -> 'a with_warnings 31(** Catch warnings accumulated by [raise_warning]. Safe to nest. *) 32 33type 'a with_errors_and_warnings = ('a, t) result with_warnings 34(** Subtype of [with_warnings]. *) 35 36val raise_errors_and_warnings : 'a with_errors_and_warnings -> 'a 37 38val catch_errors_and_warnings : (unit -> 'a) -> 'a with_errors_and_warnings 39(** Combination of [catch] and [catch_warnings]. *) 40 41type warnings_options = { 42 warn_error : bool; (** If [true], warnings will result in an error. *) 43 print_warnings : bool; (** Whether to print warnings. *) 44 warnings_tag : string option; 45 (** Whether to tag references to filter them later. *) 46} 47 48val handle_warnings : 49 warnings_options:warnings_options -> 50 'a with_warnings -> 51 ('a, [> `Msg of string ]) result 52(** Print warnings to stderr. If [warn_error] is [true] and there was warnings, 53 returns an [Error]. *) 54 55val handle_errors_and_warnings : 56 warnings_options:warnings_options -> 57 'a with_errors_and_warnings -> 58 ('a, [> `Msg of string ]) result 59(** Like [handle_warnings] but works on the output of 60 [catch_errors_and_warnings]. Error case is converted into a [`Msg]. *) 61 62val print_errors : t list -> unit 63(** Used internally by {!handle_warnings}. *) 64 65val unpack_warnings : 'a with_warnings -> 'a * t list 66 67val t_of_parser_t : Odoc_parser.Warning.t -> t 68(** Convert a parsing error into a [t]. *) 69 70val raise_parser_warnings : Odoc_parser.t -> Odoc_parser.Ast.t 71(** Like {!raise_warnings} but handle parsing errors. *)