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.@." ;
|
Format.eprintf "@{<error>@{<title>Fatal error@}@} unknown protocol version.@." ;
|
||||||
Lwt.return 1
|
Lwt.return 1
|
||||||
| Failure message ->
|
| 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
|
Lwt.return 1
|
||||||
| exn ->
|
| 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
|
Lwt.return 1
|
||||||
end >>= fun retcode ->
|
end >>= fun retcode ->
|
||||||
Format.pp_print_flush Format.err_formatter () ;
|
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 "kind" (constant "generic"))
|
||||||
(req "error" string)))
|
(req "error" string)))
|
||||||
from_error to_error in
|
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_kinds :=
|
||||||
Error_kind { id ; title ; description ;
|
Error_kind { id ; title ; description ;
|
||||||
from_error ; category ; encoding_case ; pp } :: !error_kinds
|
from_error ; category ; encoding_case ; pp } :: !error_kinds
|
||||||
@ -603,7 +603,7 @@ let () =
|
|||||||
~id:"failure"
|
~id:"failure"
|
||||||
~title:"Generic error"
|
~title:"Generic error"
|
||||||
~description:"Unclassified 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))
|
Data_encoding.(obj1 (req "msg" string))
|
||||||
(function
|
(function
|
||||||
| Exn (Failure msg) -> Some msg
|
| Exn (Failure msg) -> Some msg
|
||||||
|
Loading…
Reference in New Issue
Block a user