Fork me on GitHub

A little spec in bb, as a lib (WIP) 🙂

😎 1
Nate Sutton23:01:07

it would be nice to have clojure.stacktrace -- some of the errors in the repl are not so helpful

Nate Sutton23:01:11

nate.babashka.fs=> (directory? "asdf")
/Users/nsutton/Code/nate.babashka.fs/asdf [at /Users/nsutton/Code/nate.babashka.fs/script/, line 94, column 3]

Nate Sutton23:01:31

nate.babashka.fs=> (try (directory? "asdf") (catch Exception e (prn e)))
#error {
 :cause "/Users/nsutton/Code/nate.babashka.fs/asdf"
 [{:type clojure.lang.ExceptionInfo
   :message "/Users/nsutton/Code/nate.babashka.fs/asdf [at /Users/nsutton/Code/nate.babashka.fs/script/, line 94, column 3]"
   :data {:type :sci/error, :row 94, :col 3, :message "/Users/nsutton/Code/nate.babashka.fs/asdf [at /Users/nsutton/Code/nate.babashka.fs/script/, line 94, column 3]"}
   :at [sci.impl.utils$rethrow_with_location_of_node invokeStatic "utils.cljc" 71]}
  {:type java.nio.file.NoSuchFileException
   :message "/Users/nsutton/Code/nate.babashka.fs/asdf"
   :at [sun.nio.fs.UnixFileAttributeViews$Basic readAttributes "" 55]}]

Nate Sutton23:01:41

the root cause is the helpful bit

Nate Sutton23:01:49

and having root-cause would be handy

Nate Sutton23:01:11

I don't know if that happens at runtime, too


fwiw clojure.stacktrace is already in babashka, but not exposed. could easily be added

Nate Sutton23:01:29

cool, want me to try?


also the exceptions could probably be improved as well, somehow. not sure how

Nate Sutton23:01:15

in development which jdk should I be using?


if you have any useful notes for development, you can add them to the README in the "developing babashka" section

Nate Sutton23:01:59

I didn't clone recursive... picard-facepalm


I made an enhancement to deps.clj. Now you can do this:

  {:extra-paths ["test"]
   :extra-deps {borkdude/spartan.test {:mvn/version "0.0.4"}}
   :main-opts ["-m" "spartan.test" "-n" "borkdude.deps-test"]}}}

$ alias babashka='deps.clj -Scommand "bb -cp {{classpath}} {{main-opts}}"'
$ babashka -A:test
Ran 3 tests containing 3 assertions.
0 failures, 0 errors.
$ babashka -e '(+ 1 2 3)'

Nate Sutton23:01:09

it looks like the clojure.stacktrace change needs to be added to sci?


No, not really. You can add it to only babashka


check out the main.clj namespaces and you'll find many other things that are only added to babashka


Note that there is a babashka/impl/clojure/stacktrace.clj which you should be using

Nate Sutton23:01:05

turns out stacktraces is pretty significantly different between clj and cljs


not the normal Clojure one


the normal one had reflection issues (made a patch in JIRA for that)


I'm afk now, sleeping