Support our entity related exceptions embedded within an OrmException
This makes it easier for a service method to throw NoSuchEntityException wrapped up in an OrmException from within an OrmRunnable. Signed-off-by: Shawn O. Pearce <sop@google.com>
This commit is contained in:
@@ -52,7 +52,18 @@ public class BaseServiceImplementation {
|
||||
callback.onSuccess(r);
|
||||
}
|
||||
} catch (OrmException e) {
|
||||
callback.onFailure(e);
|
||||
if (e.getCause() instanceof Failure) {
|
||||
callback.onFailure(e.getCause().getCause());
|
||||
|
||||
} else if (e.getCause() instanceof CorruptEntityException) {
|
||||
callback.onFailure(e.getCause());
|
||||
|
||||
} else if (e.getCause() instanceof NoSuchEntityException) {
|
||||
callback.onFailure(e.getCause());
|
||||
|
||||
} else {
|
||||
callback.onFailure(e);
|
||||
}
|
||||
} catch (Failure e) {
|
||||
callback.onFailure(e.getCause());
|
||||
}
|
||||
|
Reference in New Issue
Block a user