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:
Shawn O. Pearce
2009-01-14 09:58:03 -08:00
parent f95b9e0ba7
commit 10d1f2b648

View File

@@ -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());
}