Tasks: don't print context on shell error
This commit is contained in:
parent
b779f45407
commit
bf6f19dc97
2 changed files with 48 additions and 45 deletions
|
|
@ -79,8 +79,8 @@
|
|||
(defn error-handler [^Exception e opts]
|
||||
(binding [*out* *err*]
|
||||
(let [d (ex-data e)
|
||||
cause-exit (some-> e ex-cause ex-data :exit)
|
||||
exit-code (or (:exit d) cause-exit)
|
||||
cause-exit (some-> e ex-cause ex-data :babashka/exit)
|
||||
exit-code (or (:babashka/exit d) cause-exit)
|
||||
sci-error? (isa? (:type d) :sci/error)
|
||||
ex-name (when sci-error?
|
||||
(some-> ^Throwable (ex-cause e)
|
||||
|
|
@ -88,7 +88,11 @@
|
|||
stacktrace (some->
|
||||
d :sci.impl/callstack
|
||||
cs/stacktrace)]
|
||||
(if exit-code [nil exit-code]
|
||||
(if exit-code
|
||||
(do
|
||||
(when-let [m (.getMessage e)]
|
||||
(println m))
|
||||
[nil exit-code])
|
||||
(do
|
||||
(ruler "Error")
|
||||
(println "Type: " (or
|
||||
|
|
|
|||
|
|
@ -46,11 +46,10 @@
|
|||
(continue proc))
|
||||
zero-exit?)]
|
||||
(if continue? proc
|
||||
(do (when-not zero-exit?
|
||||
(binding [*out* *err*]
|
||||
(println "Received non-zero exit code in task:" (:name @task))))
|
||||
(throw (ex-info (str "Error during task: " (:name @task))
|
||||
{:proc proc :task task :exit exit-code}))))))))
|
||||
(throw (ex-info (str "Error while executing task: " (:name @task))
|
||||
{:proc proc
|
||||
:task task
|
||||
:babashka/exit exit-code})))))))
|
||||
|
||||
(def default-opts
|
||||
{:in :inherit
|
||||
|
|
|
|||
Loading…
Reference in a new issue