-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
34 changed files
with
502 additions
and
910 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,20 +1 @@ | ||
let[@inline] error_msg ~tag ~src msg = | ||
Format.kasprintf tag "Reported from %s:\n %s" src msg | ||
|
||
let error_msgf ~tag ~src = | ||
Format.kasprintf (error_msg ~tag ~src) | ||
|
||
let append_tag ~tag ~earlier = | ||
Format.kasprintf tag "%s\n%s" earlier | ||
|
||
let append_error_msg ~tag ~earlier = | ||
error_msg ~tag:(append_tag ~tag ~earlier) | ||
|
||
let append_error_msgf ~tag ~earlier = | ||
error_msgf ~tag:(append_tag ~tag ~earlier) | ||
|
||
let pp_lines fmt msg = | ||
Format.fprintf fmt "@[<v>"; | ||
Format.(pp_print_list ~pp_sep:pp_print_cut pp_print_string) fmt @@ | ||
String.split_on_char '\n' msg; | ||
Format.fprintf fmt "@]" | ||
include Asai.Logger.Make(ErrorCode) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,14 +1 @@ | ||
val error_msg : tag:(string -> ('a, 'b) result) -> src:string -> string -> ('a, 'b) result | ||
(** Turn an error message into an error. *) | ||
|
||
val error_msgf : tag:(string -> ('a, 'b) result) -> src:string -> ('c, Format.formatter, unit, ('a, 'b) result) format4 -> 'c | ||
(** Format an error message. *) | ||
|
||
val append_error_msg : tag:(string -> ('a, 'b) result) -> earlier:string -> src:string -> string -> ('a, 'b) result | ||
(** Append an error message to an earlier error. *) | ||
|
||
val append_error_msgf : tag:(string -> ('a, 'b) result) -> earlier:string -> src:string -> ('c, Format.formatter, unit, ('a, 'b) result) format4 -> 'c | ||
(** Format and append an error message to an earlier error. *) | ||
|
||
val pp_lines : Format.formatter -> string -> unit | ||
(** Pretty printer that hints newlines for ['\n']. *) | ||
include Asai.Logger.S with module Code := ErrorCode |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,19 @@ | ||
type t = | ||
[ `System | ||
| `AnchorNotFound | ||
| `JSONFormat | ||
| `UnitNotFound | ||
| `InvalidLibrary | ||
| `InvalidRouter | ||
] | ||
|
||
let default_severity _ = Asai.Severity.Error | ||
|
||
let to_string : t -> string = | ||
function | ||
| `System -> "sys" | ||
| `AnchorNotFound -> "anchor" | ||
| `JSONFormat -> "json" | ||
| `UnitNotFound -> "unit" | ||
| `InvalidLibrary -> "lib" | ||
| `InvalidRouter -> "router" |
This file was deleted.
Oops, something went wrong.
This file was deleted.
Oops, something went wrong.
Oops, something went wrong.