|
73 | 73 | import com.arangodb.http.BatchHttpManager; |
74 | 74 | import com.arangodb.http.BatchPart; |
75 | 75 | import com.arangodb.http.HttpManager; |
| 76 | +import com.arangodb.http.HttpResponseEntity; |
76 | 77 | import com.arangodb.http.InvocationHandlerImpl; |
77 | 78 | import com.arangodb.impl.ImplFactory; |
78 | 79 | import com.arangodb.impl.InternalBatchDriverImpl; |
@@ -408,8 +409,21 @@ public <T> T getBatchResponseByRequestId(final String requestId) throws ArangoEx |
408 | 409 | this.httpManager.setPreDefinedResponse(null); |
409 | 410 | return result; |
410 | 411 | } catch (final InvocationTargetException e) { |
411 | | - final T result = (T) createEntity(batchResponseEntity.getHttpResponseEntity(), DefaultEntity.class); |
412 | 412 | this.httpManager.setPreDefinedResponse(null); |
| 413 | + |
| 414 | + HttpResponseEntity httpResponse = batchResponseEntity.getHttpResponseEntity(); |
| 415 | + if (httpResponse.getStatusCode() >= 300) { |
| 416 | + DefaultEntity de = new DefaultEntity(); |
| 417 | + de.setCode(httpResponse.getStatusCode()); |
| 418 | + de.setError(true); |
| 419 | + if (httpResponse.getText() != null) { |
| 420 | + de.setErrorMessage(httpResponse.getText().trim()); |
| 421 | + } |
| 422 | + de.setErrorNumber(httpResponse.getStatusCode()); |
| 423 | + throw new ArangoException(de); |
| 424 | + } |
| 425 | + |
| 426 | + final T result = (T) createEntity(batchResponseEntity.getHttpResponseEntity(), DefaultEntity.class); |
413 | 427 | return result; |
414 | 428 | } catch (final Exception e) { |
415 | 429 | this.httpManager.setPreDefinedResponse(null); |
|
0 commit comments