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.
for example one of my classes is throwing a NoSessionException
. Can I check a throwable object if it is a NoSessionException
?
You can use instanceof
to check it is of NoSessionException
or not.
Example:
if (exp instanceof NoSessionException) {
...
}
Assuming exp
is the Throwable
reference.