/** * @throws Exception * throws first error thrown by an event, or does nothing if no error occurred. */ public void throwErrorIfPresent() throws Exception { if (this.wasErrorThrown()) { Throwable thrown = this.getErrorThrown(); if (thrown instanceof Exception) { throw (Exception) thrown; } else { throw new Exception(thrown); } } }
/** * @throws Exception * throws first error thrown by an event, or does nothing if no error occurred. */ public void throwErrorIfPresent() throws Exception { if (this.wasErrorThrown()) { Throwable thrown = this.getErrorThrown(); if (thrown instanceof Exception) { throw (Exception) thrown; } else { throw new Exception(thrown); } } }
/** * Utility method to check an {@link StorageServiceEventAdaptor} for the occurrence of an error, * and if one is present to throw it. * * @param adaptor * @throws ServiceException */ protected void throwError(StorageServiceEventAdaptor adaptor) throws ServiceException { if (adaptor.wasErrorThrown()) { Throwable thrown = adaptor.getErrorThrown(); if (thrown instanceof ServiceException) { throw (ServiceException) thrown; } else { throw new ServiceException(thrown); } } }
/** * Utility method to check an {@link StorageServiceEventAdaptor} for the occurrence of an error, * and if one is present to throw it. * * @param adaptor * @throws ServiceException */ protected void throwError(StorageServiceEventAdaptor adaptor) throws ServiceException { if (adaptor.wasErrorThrown()) { Throwable thrown = adaptor.getErrorThrown(); if (thrown instanceof ServiceException) { throw (ServiceException) thrown; } else { throw new ServiceException(thrown); } } }