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]
|
(defn error-handler [^Exception e opts]
|
||||||
(binding [*out* *err*]
|
(binding [*out* *err*]
|
||||||
(let [d (ex-data e)
|
(let [d (ex-data e)
|
||||||
cause-exit (some-> e ex-cause ex-data :exit)
|
cause-exit (some-> e ex-cause ex-data :babashka/exit)
|
||||||
exit-code (or (:exit d) cause-exit)
|
exit-code (or (:babashka/exit d) cause-exit)
|
||||||
sci-error? (isa? (:type d) :sci/error)
|
sci-error? (isa? (:type d) :sci/error)
|
||||||
ex-name (when sci-error?
|
ex-name (when sci-error?
|
||||||
(some-> ^Throwable (ex-cause e)
|
(some-> ^Throwable (ex-cause e)
|
||||||
|
|
@ -88,7 +88,11 @@
|
||||||
stacktrace (some->
|
stacktrace (some->
|
||||||
d :sci.impl/callstack
|
d :sci.impl/callstack
|
||||||
cs/stacktrace)]
|
cs/stacktrace)]
|
||||||
(if exit-code [nil exit-code]
|
(if exit-code
|
||||||
|
(do
|
||||||
|
(when-let [m (.getMessage e)]
|
||||||
|
(println m))
|
||||||
|
[nil exit-code])
|
||||||
(do
|
(do
|
||||||
(ruler "Error")
|
(ruler "Error")
|
||||||
(println "Type: " (or
|
(println "Type: " (or
|
||||||
|
|
|
||||||
|
|
@ -46,11 +46,10 @@
|
||||||
(continue proc))
|
(continue proc))
|
||||||
zero-exit?)]
|
zero-exit?)]
|
||||||
(if continue? proc
|
(if continue? proc
|
||||||
(do (when-not zero-exit?
|
(throw (ex-info (str "Error while executing task: " (:name @task))
|
||||||
(binding [*out* *err*]
|
{:proc proc
|
||||||
(println "Received non-zero exit code in task:" (:name @task))))
|
:task task
|
||||||
(throw (ex-info (str "Error during task: " (:name @task))
|
:babashka/exit exit-code})))))))
|
||||||
{:proc proc :task task :exit exit-code}))))))))
|
|
||||||
|
|
||||||
(def default-opts
|
(def default-opts
|
||||||
{:in :inherit
|
{:in :inherit
|
||||||
|
|
|
||||||
Loading…
Reference in a new issue