Include full stacktrace for unexpected exceptions (#781)

* Include full stacktrace for unexpected exceptions

* Update lib/livebook_cli.ex

Co-authored-by: Jonatan Kłosko <jonatanklosko@gmail.com>
This commit is contained in:
José Valim 2021-12-09 15:44:23 +01:00 committed by GitHub
parent 33b220873f
commit c66582f8bb
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23

View file

@ -53,9 +53,16 @@ defmodule LivebookCLI do
try do
task.call(args)
rescue
error in OptionParser.ParseError ->
IO.ANSI.format([
:red,
Exception.message(error),
"\n\nFor more information try --help"
])
|> IO.puts()
error ->
IO.ANSI.format([:red, Exception.message(error), "\n"]) |> IO.puts()
IO.write(task.usage())
IO.ANSI.format([:red, Exception.format(:error, error, __STACKTRACE__), "\n"]) |> IO.puts()
end
end