upgrade sci for try/catch, add exception bindings (#75)

This commit is contained in:
Michiel Borkent 2019-09-25 23:28:32 +02:00 committed by GitHub
parent 8a4ab771d8
commit 5159a335ad
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
4 changed files with 14 additions and 2 deletions

2
sci

@ -1 +1 @@
Subproject commit 095e66ed99b57089f1478bd17ae2f23710273867
Subproject commit c1a70167bed16004b5cd57add028215184a4f708

View file

@ -0,0 +1,7 @@
(ns babashka.impl.exceptions)
(def exception-bindings
{'Exception Exception
'java.lang.Exception Exception
'ArithmeticException ArithmeticException
'java.lang.ArithmeticException ArithmeticException})

View file

@ -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*

View file

@ -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))"))))