Open aboytsov opened 9 years ago
@aboytsov -- this issue comes up a lot, but Slingshot does not match on Exception e. Or at least, it didn't for a long time. For those circumstances where you want Slingshot to catch everything, you match on Object:
(catch Object o
(println "caught " (type o) )))
It looks like slingshot gets a bit confused with chained exceptions, specifically when the outer exception is a regular one, and the cause is the slingshot wrapper:
Here things seem to behave as expected. But consider what happens if the only change I make is replace the second
try
withtry+
:What seems to be happening is that under
try+
(catch Exception e
block doesn't match anything. I looked at the expanded code and it seems like Slingshot is under the impression that this exception is still a wrapped exception (and it initializes:object &throw-context
accordingly) even though the wrapped exception is the cause and the main one is ajava.lang.Exception
.Needless to say, this is pretty confusing. Am I missing something?