This page is not created by, affiliated with, or supported by Slack Technologies, Inc.
2017-07-03
Channels
- # aws (1)
- # beginners (5)
- # boot (46)
- # cider (6)
- # cljs-dev (421)
- # cljsrn (74)
- # clojure (77)
- # clojure-greece (1)
- # clojure-italy (7)
- # clojure-russia (12)
- # clojure-serbia (42)
- # clojure-sg (1)
- # clojure-spec (10)
- # clojure-uk (38)
- # clojurescript (40)
- # core-async (14)
- # data-science (1)
- # datomic (18)
- # emacs (2)
- # events (1)
- # garden (4)
- # gorilla (4)
- # graphql (5)
- # hoplon (69)
- # luminus (1)
- # lumo (1)
- # off-topic (31)
- # om (31)
- # om-next (2)
- # overtone (3)
- # pedestal (1)
- # precept (4)
- # re-frame (23)
- # reagent (2)
- # remote-jobs (1)
- # ring-swagger (23)
- # rum (7)
- # spacemacs (7)
- # sql (4)
- # unrepl (9)
- # untangled (5)
- # vim (11)
- # yada (5)
I am trying to test a java.sql.SQLException
handler which unwraps the exceptions like below. However I'm not sure how I would throw this exception in a test.
(-> e
(.getNextException)
(.getMessage)
(.startsWith "ERROR: duplicate key value"))
current mock (`.getNextException` returns nil on this):
(throw (SQLException. "ERROR: duplicate key value"))
@hackeryarn use setNextException()
: http://docs.oracle.com/javase/8/docs/api/java/sql/SQLException.html#setNextException-java.sql.SQLException-
Ah thank you @seancorfield, looks like a BatchUpdateException
is actually thrown before the duplicate key exception and that's why the .getNextException
is needed.
That helped me understand how the transaction is run a bit better too.