upgrade sci for try/catch, add exception bindings (#75)
This commit is contained in:
parent
8a4ab771d8
commit
5159a335ad
4 changed files with 14 additions and 2 deletions
2
sci
2
sci
|
|
@ -1 +1 @@
|
|||
Subproject commit 095e66ed99b57089f1478bd17ae2f23710273867
|
||||
Subproject commit c1a70167bed16004b5cd57add028215184a4f708
|
||||
7
src/babashka/impl/exceptions.clj
Normal file
7
src/babashka/impl/exceptions.clj
Normal file
|
|
@ -0,0 +1,7 @@
|
|||
(ns babashka.impl.exceptions)
|
||||
|
||||
(def exception-bindings
|
||||
{'Exception Exception
|
||||
'java.lang.Exception Exception
|
||||
'ArithmeticException ArithmeticException
|
||||
'java.lang.ArithmeticException ArithmeticException})
|
||||
|
|
@ -13,6 +13,7 @@
|
|||
[babashka.impl.pipe-signal-handler :refer [handle-pipe! pipe-signal-received?]]
|
||||
[babashka.impl.socket-repl :as socket-repl]
|
||||
[babashka.impl.tools.cli :refer [tools-cli-namespace]]
|
||||
[babashka.impl.exceptions :refer [exception-bindings]]
|
||||
[babashka.net :as net]
|
||||
[clojure.edn :as edn]
|
||||
[clojure.java.io :as io]
|
||||
|
|
@ -146,7 +147,8 @@ Everything after that is bound to *command-line-args*."))
|
|||
system-bindings
|
||||
file-bindings
|
||||
thread-bindings
|
||||
integer-bindings))
|
||||
integer-bindings
|
||||
exception-bindings))
|
||||
|
||||
(defn read-edn []
|
||||
(edn/read {;;:readers *data-readers*
|
||||
|
|
|
|||
|
|
@ -188,3 +188,6 @@
|
|||
|
||||
(deftest tools-cli-test
|
||||
(is (= {:result 8080} (bb nil "test/babashka/scripts/tools.cli.bb"))))
|
||||
|
||||
(deftest try-catch-test
|
||||
(is (zero? (bb nil "(try (/ 1 0) (catch ArithmeticException _ 0))"))))
|
||||
|
|
|
|||
Loading…
Reference in a new issue