Package io.objectbox.exception
Interface DbExceptionListener
-
public interface DbExceptionListener
Listener for exceptions occurring during database operations. Set viaBoxStore.setDbExceptionListener(DbExceptionListener)
.
-
-
Method Summary
All Methods Static Methods Instance Methods Abstract Methods Modifier and Type Method Description static void
cancelCurrentException()
WARNING/DISCLAIMER: Please avoid this method and handle exceptions "properly" instead.void
onDbException(java.lang.Exception e)
Called when an exception is thrown during a database operation.
-
-
-
Method Detail
-
cancelCurrentException
@Experimental static void cancelCurrentException()
WARNING/DISCLAIMER: Please avoid this method and handle exceptions "properly" instead. By using this method, you "hack" into the exception handling by preventing native core exceptions to be raised in Java. This typically results in methods returning zero or null regardless if this breaks any non-zero or non-null contract that would be in place otherwise. Additionally, "canceling" exceptions may lead to unforeseen follow-up errors that would never occur otherwise. In short, by using this method you are accepting undefined behavior.Also note that it is likely that this method will never graduate from @
Experimental
until it is removed.This method may be only called from
onDbException(Exception)
.
-
onDbException
void onDbException(java.lang.Exception e)
Called when an exception is thrown during a database operation. Do NOT throw exceptions in this method: throw exceptions are ignored (but logged to stderr).- Parameters:
e
- the exception occurred during a database operation
-
-