Expose jolt.host/throwable
A library that throws a typed host exception (an http client raising java.net.ConnectException) needs (class e), instance?, .getMessage and ex-message to all reflect the named class. jolt-host-throwable already builds that value; expose it as a jolt.host seam so libraries stop hand-rolling a :jolt/ex-info table that carries only the class (its .getMessage/ex-message return nil).
This commit is contained in:
parent
3d80bdc10b
commit
cc26e3abba
1 changed files with 5 additions and 0 deletions
|
|
@ -110,6 +110,11 @@
|
|||
;; (pr-str (def x 1)) is "#'ns/x". The prelude's def-var! forms discard the
|
||||
;; return, so this is transparent there.
|
||||
(define (def-var! ns name v) (let ((c (jolt-var ns name))) (var-cell-root-set! c v) (var-cell-defined?-set! c #t) c))
|
||||
;; jolt.host/throwable — build a typed throwable a library can throw so (class …),
|
||||
;; instance?, .getMessage and ex-message all reflect the named JVM class (e.g. an
|
||||
;; http client throwing java.net.ConnectException). Strictly better than a
|
||||
;; hand-rolled :jolt/ex-info table, which carries only the class.
|
||||
(def-var! "jolt.host" "throwable" jolt-host-throwable)
|
||||
;; var def-time metadata: the :def emit passes the def's reader meta
|
||||
;; (^:private / ^Type tag / docstring -> {:doc}) here, stored in an eq side-table
|
||||
;; keyed by the cell. jolt-meta (natives-meta.ss) merges it onto {:ns :name},
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue