Java - Throwable to Exception

后端 未结 5 1334
清酒与你
清酒与你 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:10

    Just make it short. We can pass Throwable to Exception constructor.

     @Override
     public void onError(Throwable e) {
        Exception ex = new Exception(e);
     }               
    

    See this Exception from Android

提交回复
热议问题