Most Clojure data structures are lazy, which means that they are evaluated only as needed. To make these lazy structures play nicely with conditions (or even plain old exceptions, for that matter), you have to install your handlers around the code that actually realizes the collection, not around the code that creates the collection.
This can be confusing at the REPL. Can you spot the problem here?
|||(map parse-log-entry bad-log)|
|||(handle malformed-log-entry [msg]|
|||-> java.lang.IllegalArgumentException: this is not a log message|
This code is trying to add a handler, but it isn’t working. Stepping through the sequence of events will show why:
The with-handler block sets a handler. ...