use of network.bisq.api.NotFoundException in project bisq-api by mrosseel.
the class TradeResource method handlePaymentStatusChange.
private void handlePaymentStatusChange(String tradeId, AsyncResponse asyncResponse, CompletableFuture<Void> completableFuture) {
completableFuture.thenApply(response -> asyncResponse.resume(Response.status(Response.Status.OK).build())).exceptionally(e -> {
final Throwable cause = e.getCause();
final Response.ResponseBuilder responseBuilder;
if (cause instanceof ValidationException) {
responseBuilder = toValidationErrorResponse(cause, 422);
} else if (cause instanceof NotFoundException) {
responseBuilder = toValidationErrorResponse(cause, 404);
} else {
final String message = cause.getMessage();
responseBuilder = Response.status(500);
if (null != message)
responseBuilder.entity(new ValidationErrorMessage(ImmutableList.of(message)));
log.error("Unable to confirm payment started for trade: " + tradeId, cause);
}
return asyncResponse.resume(responseBuilder.build());
});
}
Aggregations