Client: minor error printing tweaks
This commit is contained in:
parent
51cfa388f8
commit
fe435ce114
@ -143,10 +143,12 @@ let main select_commands =
|
||||
Format.eprintf "@{<error>@{<title>Fatal error@}@} unknown protocol version.@." ;
|
||||
Lwt.return 1
|
||||
| Failure message ->
|
||||
Format.eprintf "@{<error>@{<title>Fatal error@}@} %s.@." message ;
|
||||
Format.eprintf "@{<error>@{<title>Fatal error@}@} @[<hov 0>%a@]@."
|
||||
Format.pp_print_text message ;
|
||||
Lwt.return 1
|
||||
| exn ->
|
||||
Format.printf "@{<error>@{<title>Fatal error@}@} %s.@." (Printexc.to_string exn) ;
|
||||
Format.printf "@{<error>@{<title>Fatal error@}@} @[<hov 0>%a@]@."
|
||||
Format.pp_print_text (Printexc.to_string exn) ;
|
||||
Lwt.return 1
|
||||
end >>= fun retcode ->
|
||||
Format.pp_print_flush Format.err_formatter () ;
|
||||
|
@ -124,7 +124,7 @@ module Make(Prefix : sig val id : string end) = struct
|
||||
(req "kind" (constant "generic"))
|
||||
(req "error" string)))
|
||||
from_error to_error in
|
||||
let pp = Format.pp_print_string in
|
||||
let pp ppf s = Format.fprintf ppf "@[<h 0>%a@]" Format.pp_print_text s in
|
||||
error_kinds :=
|
||||
Error_kind { id ; title ; description ;
|
||||
from_error ; category ; encoding_case ; pp } :: !error_kinds
|
||||
@ -603,7 +603,7 @@ let () =
|
||||
~id:"failure"
|
||||
~title:"Generic error"
|
||||
~description:"Unclassified error"
|
||||
~pp:Format.pp_print_string
|
||||
~pp:(fun ppf s -> Format.fprintf ppf "@[<h 0>%a@]" Format.pp_print_text s)
|
||||
Data_encoding.(obj1 (req "msg" string))
|
||||
(function
|
||||
| Exn (Failure msg) -> Some msg
|
||||
|
Loading…
Reference in New Issue
Block a user