I am currently using the play2 framework.
I have several classes which are throwing exceptions but play2s global onError handler uses throwable instead of an exception.
exceptions
onError
for example one of my classes is throwing a NoSessionException. Can I check a throwable object if it is a NoSessionException ?
NoSessionException
You can use instanceof to check it is of NoSessionException or not.
instanceof
Example:
if (exp instanceof NoSessionException) { ... }
Assuming exp is the Throwable reference.
exp
Throwable
1.4m articles
1.4m replys
5 comments
57.0k users