2019-12-16 21:37:52 +04:00
|
|
|
open Cmdliner
|
2019-06-28 16:05:04 +04:00
|
|
|
open Trace
|
2019-09-20 13:59:44 +04:00
|
|
|
open Main.Display
|
2019-06-28 16:05:04 +04:00
|
|
|
|
2020-01-08 14:54:21 +04:00
|
|
|
let error_suggest: string = "\n If you're not sure how to fix this error, you can
|
|
|
|
do one of the following:
|
|
|
|
|
|
|
|
* Visit our documentation: https://ligolang.org/docs/intro/what-and-why/
|
|
|
|
* Ask a question on our Discord: https://discord.gg/9rhYaEt
|
|
|
|
* Open a gitlab issue: https://gitlab.com/ligolang/ligo/issues/new
|
2020-01-17 19:29:23 +04:00
|
|
|
* Check the changelog by running 'ligo changelog'\n"
|
2020-01-08 14:54:21 +04:00
|
|
|
|
2019-12-16 21:37:52 +04:00
|
|
|
let toplevel ~(display_format : display_format) (x : string result) : unit Term.ret =
|
2019-09-04 20:41:14 +04:00
|
|
|
match x with
|
2019-12-16 21:37:52 +04:00
|
|
|
| Ok _ -> Format.printf "%a%!" (formatted_string_result_pp display_format) x;
|
|
|
|
`Ok ()
|
2019-09-04 20:41:14 +04:00
|
|
|
| Error _ ->
|
2020-01-08 14:54:21 +04:00
|
|
|
begin
|
|
|
|
match display_format with
|
|
|
|
| `Human_readable -> print_string error_suggest ;
|
|
|
|
| _ -> ()
|
|
|
|
end ;
|
|
|
|
`Error (false, Format.asprintf "%a%!" (formatted_string_result_pp display_format) x)
|