Hi all - I have a pod that can throw org.postgresql.util.PSQLException -- it's wrapping Postgres.
I am using transit for serialize/deserializing...what would you suggest me to handle it?
Apologies, this is my first time writing a pod and I am investigating other pods in the meantime
if you can't create this exception on the pod client (bb presumably), then just convert it to an ex-info?
hmm yes that is probably a good idea - this is thrown from the bb pod to the client and the pod does not have the right write handler
you can check babashka sql pods how to handle it probably
we already have a postgres pod btw
well I checked but I don't see that class handled
yep I know that's my source of inspiration 🙂
found this approach that seems sensible https://github.com/xtdb/xtdb/blob/4c440c03d1d4019de3b776dc87c5a82e7b099882/api/src/main/clojure/xtdb/serde.clj#L214C11-L215C11
yeah sure. bb sql pods has stuff like this too if I remember correctly
I actually discovered that org.postgresql.util.PSQLException class is thrown somewhere along the function class - that's why it was not caught
yeah that's very weird lol - still debugging
@borkdude so it seems like the transit handler skips the org.postgresql.util.PSQLException handler and goes into the generic java.lang.Class
I am not sure this is related to bb but was wondering if you ever encountered that behavior
I have got this
java.lang.Class (transit/write-handler "foo"
(fn [e] (println "\n22222") (println e) (str e)))
and I see
22222
org.postgresql.util.PSQLExceptionI am not sure why but this is the only change I needed to add to my write handlers and now I see the exception correctly thrown:
java.lang.Class (transit/write-handler class-key str)
2026-02-23T18:30:48.613Z XXX INFO [...] - SRV000943046: ❌ FATAL: too many connections for role "foo"
----- Error --------------------------------------------------------------------
Type: clojure.lang.ExceptionInfo
Message: FATAL: too many connections for role "foo"
Data: {:type #object[com.cognitect.transit.impl.TaggedValueImpl 0x34f48030 "com.cognitect.transit.impl.TaggedValueImpl@4936ad81"]}
Location: ...
👍