我想只处理某种类型的异常并重新抛出它,如果它是另一种类型的异常:
future.exceptionally
(
(error) ->
{
bool wouldBeHandled = ...;
if (wouldBeHandled)
{
Handle();
}
else
{
throw error; //Want to do this, but can't
throw new RuntimeException(error); //I don't want to wrap
}
}
);