You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Applying --debug gives us more inner details, but not on the exception cause(s).
Clojure Behaviour
Let's take a look at what Clojure does.
❯ clojure --version
Clojure CLI version 1.11.1.1252
Default
❯ clojure -M test.clj
Execution error (ExceptionInfo) at test/fn3 (test.clj:4).
fn3 badnesss happened
Full report at:
/tmp/clojure-2455531978435573272.edn
Clojure reports on the root cause only by default (with full report to a file).
The Clojure core team feels that the root cause is typically most interesting part of the exception.
What it does not give you is the context that the exception and other causes would provide.
With --report stderr
Let's tell Clojure to send the full report to the terminal instead:
Note: if the root cause came from some Java lib, we'd not show the context.
The user might also be interested in other causes, so other options might come into play, but I think maybe showing the exception and root cause might typically be enough info.
Option 4 - Offer full edn report like Clojure does
Mimic Clojure edn report (in a way that makes sense for bb).
Write report to tmp file with option to spit it to terminal.
Option 5 - Spit out causes for --debug
Also spit out info on exception causes when user invokes bb with --debug.
Option n -
There are many ways to solve this, could convert this to a discussion if that makes sense.
The text was updated successfully, but these errors were encountered:
Experimental commit in https://github.com/babashka/babashka/tree/issue-1515
It's probably not the final thing yet. Showing the root context isn't possible since only the stacktrace is preserved when you request that with ^:sci/stacktrace:
Issue
When an uncaught exception occurs, babashka displays the exception but not the cause(s).
This can make troubleshooting difficult.
Realworld Context
We were diagnosing an Etaoin issue.
If Bashashka shared the root cause of the thrown exception, our job would have been easier.
Exploring Current Behaviour
We'll explore current behaviour with a
test.clj
:Babashka Behaviour
Default
We get info on the exception but no info on the cause(s).
With --debug
Does
--debug
provide more info?Applying
--debug
gives us more inner details, but not on the exception cause(s).Clojure Behaviour
Let's take a look at what Clojure does.
Default
Clojure reports on the root cause only by default (with full report to a file).
The Clojure core team feels that the root cause is typically most interesting part of the exception.
What it does not give you is the context that the exception and other causes would provide.
With --report stderr
Let's tell Clojure to send the full report to the terminal instead:
Cool, the report shows all of the causes under
:via
giving us full context.Proposals
There are a many viable ways to address this issue, think of the following options as initial ideas.
Option 1 - Do nothing
Always an option, right?
Option 2 - Add a causes section
Summarize all causes, a mockup of a terse report:
Option 3 - Show the exception and its root cause
Perhaps the most interesting parts of an exception are the exception and its root cause.
Bb is already showing the exception.
It could by default also show the root cause, with the context if possible.
----- Root Cause --------------------------------------------------------------- Type: clojure.lang.ExceptionInfo Message: fn3 badnesss happened Data: {:fn3 :data} Location: /home/lee/proj/oss/-play/bb-cause/test.clj:4:3 ----- Root Cause Context ------------------------------------------------------- 01: (ns test) 02: 03: (defn fn3 [] 04: (throw (ex-info "fn3 badnesss happened" {:fn3 :data}))) ^--- fn3 badness happened 05: 06: (defn fn2 [] 07: (try
Note: if the root cause came from some Java lib, we'd not show the context.
The user might also be interested in other causes, so other options might come into play, but I think maybe showing the exception and root cause might typically be enough info.
Option 4 - Offer full edn report like Clojure does
Mimic Clojure edn report (in a way that makes sense for bb).
Write report to tmp file with option to spit it to terminal.
Option 5 - Spit out causes for --debug
Also spit out info on exception causes when user invokes bb with
--debug
.Option n -
There are many ways to solve this, could convert this to a discussion if that makes sense.
The text was updated successfully, but these errors were encountered: