File tree Expand file tree Collapse file tree
Expand file tree Collapse file tree Original file line number Diff line number Diff line change @@ -73,6 +73,8 @@ module Make(Driver: Driver)(P: Parameters) = struct
7373 type error = string * t option
7474 exception Protocol_error of error
7575
76+ let make_error ?value msg = (msg, value)
77+
7678 let error_to_string_hum: error -> string = function
7779 | (s , Some t ) -> Printf. sprintf " %s. Got: %s" s (Driver. to_string_hum t)
7880 | (s , None) -> s
Original file line number Diff line number Diff line change @@ -6,6 +6,8 @@ type t = Xml.xml
66type error = string * t option
77exception Protocol_error of error
88
9+ let make_error ?value msg = (msg, value)
10+
911let to_string_hum xml = Xml. to_string_fmt xml
1012
1113let error_to_string_hum: error -> string = function
Original file line number Diff line number Diff line change @@ -22,6 +22,8 @@ type t =
2222type error = string * t option
2323exception Protocol_error of error
2424
25+ let make_error ?value msg = (msg, value)
26+
2527let to_string_hum t = sexp_of_t t |> Sexp. to_string_hum
2628let error_to_string_hum: error -> string = function
2729 | (s , Some t ) -> Printf. sprintf " %s. T: '%s'" s (to_string_hum t)
Original file line number Diff line number Diff line change @@ -53,6 +53,9 @@ module type Driver = sig
5353 this is the only exception raised when deserializing *)
5454 exception Protocol_error of error
5555
56+ (* * Construct an error to be raised from a custom parser. *)
57+ val make_error : ?value : t -> string -> error
58+
5659 (* * Convert an error type to a human readable string *)
5760 val error_to_string_hum : error -> string
5861
You can’t perform that action at this time.
0 commit comments