-
Notifications
You must be signed in to change notification settings - Fork 23
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
NPE when using :handlers instead of meaningful error message #50
Comments
Can you drop |
|
@borkdude the above code will work if you provide the a default handler like this: (deftype DefaultHandler []
WriteHandler
(tag [this v] "unknown")
(rep [this v] (pr-str v)))
(defn write-transit [v]
(let [baos (java.io.ByteArrayOutputStream.)
default-handler (transit/write-handler
(fn [_] "atom")
(fn [a] @a))]
(transit/write (transit/writer baos :json {:default-handler (DefaultHandler.)
:handlers {java.time.LocalDateTime ldt-write-handler}}) v)
(.toString baos "utf-8")))
(write-transit (into-array String ["foo"]))
;; => ["~#unknown" "#object[\"[Ljava.lang.String;\" 0x711ae4e6 \"[Ljava.lang.String;@711ae4e6\"]"] I guess by design you have to provide |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
It seems transit is giving an NPE instead of a meaningful error message when using
:handlers
and you give it a type it can't handle:The text was updated successfully, but these errors were encountered: