Java Code Examples for com.arangodb.ArangoDBException#getErrorNum()
The following examples show how to use
com.arangodb.ArangoDBException#getErrorNum() .
You can vote up the ones you like or vote down the ones you don't like,
and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example 1
Source File: ArangoCollectionAsyncImpl.java From arangodb-java-driver-async with Apache License 2.0 | 6 votes |
private <T> Function<Throwable, T> handleGetDocumentExceptions(Boolean isCatchException) { return throwable -> { if (throwable instanceof CompletionException) { if (throwable.getCause() instanceof ArangoDBException) { ArangoDBException arangoDBException = (ArangoDBException) throwable.getCause(); // handle Response: 404, Error: 1655 - transaction not found if (arangoDBException.getErrorNum() != null && arangoDBException.getErrorNum() == 1655) { throw (CompletionException) throwable; } if ((arangoDBException.getResponseCode() != null && (arangoDBException.getResponseCode() == 404 || arangoDBException.getResponseCode() == 304 || arangoDBException.getResponseCode() == 412)) && isCatchException) { return null; } } throw (CompletionException) throwable; } throw new CompletionException(throwable); }; }
Example 2
Source File: ArangoCollectionImpl.java From arangodb-java-driver with Apache License 2.0 | 6 votes |
@Override public <T> T getDocument(final String key, final Class<T> type, final DocumentReadOptions options) throws ArangoDBException { DocumentUtil.validateDocumentKey(key); try { return executor.execute(getDocumentRequest(key, options), type); } catch (final ArangoDBException e) { if (LOGGER.isDebugEnabled()) { LOGGER.debug(e.getMessage(), e); } // handle Response: 404, Error: 1655 - transaction not found if (e.getErrorNum() != null && e.getErrorNum() == 1655) { throw e; } if ((e.getResponseCode() != null && (e.getResponseCode() == 404 || e.getResponseCode() == 304 || e.getResponseCode() == 412)) && (options == null || options.isCatchException())) { return null; } throw e; } }
Example 3
Source File: ArangoCollectionImpl.java From arangodb-java-driver with Apache License 2.0 | 6 votes |
@Override public Boolean documentExists(final String key, final DocumentExistsOptions options) throws ArangoDBException { try { executor.execute(documentExistsRequest(key, options), VPackSlice.class); return true; } catch (final ArangoDBException e) { // handle Response: 404, Error: 1655 - transaction not found if (e.getErrorNum() != null && e.getErrorNum() == 1655) { throw e; } if ((e.getResponseCode() != null && (e.getResponseCode() == 404 || e.getResponseCode() == 304 || e.getResponseCode() == 412)) && (options == null || options.isCatchException())) { return false; } throw e; } }
Example 4
Source File: ExceptionUtil.java From arangodb-java-driver with Apache License 2.0 | 6 votes |
static <T> Function<Throwable, T> catchGetDocumentExceptions(Boolean isCatchException) { return throwable -> { if (throwable instanceof CompletionException) { if (throwable.getCause() instanceof ArangoDBException) { ArangoDBException arangoDBException = (ArangoDBException) throwable.getCause(); // handle Response: 404, Error: 1655 - transaction not found if (arangoDBException.getErrorNum() != null && arangoDBException.getErrorNum() == 1655) { throw (CompletionException) throwable; } if ((arangoDBException.getResponseCode() != null && (arangoDBException.getResponseCode() == 404 || arangoDBException.getResponseCode() == 304 || arangoDBException.getResponseCode() == 412)) && isCatchException) { return null; } } throw (CompletionException) throwable; } throw new CompletionException(throwable); }; }