Java - Throwable to Exception

后端 未结 5 1213
清酒与你
清酒与你 2021-02-03 20:26

I am currently using the play2 framework.

I have several classes which are throwing exceptions but play2s global onError handler uses throwable

5条回答
  •  一个人的身影
    2021-02-03 21:02

    You can use instanceof to check it is of NoSessionException or not.

    Example:

    if (exp instanceof NoSessionException) {
    ...
    }
    

    Assuming exp is the Throwable reference.

提交回复
热议问题