(final Exception e)
| 588 | /** This has to be attached to callbacks or we may never respond to clients */ |
| 589 | class ErrorCB implements Callback<Object, Exception> { |
| 590 | public Object call(final Exception e) throws Exception { |
| 591 | QueryRpc.query_exceptions.incrementAndGet(); |
| 592 | Throwable ex = e; |
| 593 | try { |
| 594 | LOG.error("Query exception: ", e); |
| 595 | if (e instanceof DeferredGroupException) { |
| 596 | ex = e.getCause(); |
| 597 | while (ex != null && ex instanceof DeferredGroupException) { |
| 598 | ex = ex.getCause(); |
| 599 | } |
| 600 | if (ex == null) { |
| 601 | LOG.error("The deferred group exception didn't have a cause???"); |
| 602 | } |
| 603 | } |
| 604 | if (ex instanceof RpcTimedOutException) { |
| 605 | QueryExecutor.this.http_query.badRequest(new BadRequestException( |
| 606 | HttpResponseStatus.REQUEST_TIMEOUT, ex.getMessage())); |
| 607 | } else if (ex instanceof HBaseException) { |
| 608 | QueryExecutor.this.http_query.badRequest(new BadRequestException( |
| 609 | HttpResponseStatus.FAILED_DEPENDENCY, ex.getMessage())); |
| 610 | } else if (ex instanceof QueryException) { |
| 611 | QueryExecutor.this.http_query.badRequest(new BadRequestException( |
| 612 | ((QueryException)ex).getStatus(), ex.getMessage())); |
| 613 | } else if (ex instanceof BadRequestException) { |
| 614 | QueryExecutor.this.http_query.badRequest((BadRequestException)ex); |
| 615 | } else if (ex instanceof NoSuchUniqueName) { |
| 616 | QueryExecutor.this.http_query.badRequest(new BadRequestException(ex)); |
| 617 | } else { |
| 618 | QueryExecutor.this.http_query.badRequest(new BadRequestException(ex)); |
| 619 | } |
| 620 | |
| 621 | } catch (RuntimeException ex2) { |
| 622 | LOG.error("Exception thrown during exception handling", ex2); |
| 623 | QueryExecutor.this.http_query.sendReply |
| 624 | (HttpResponseStatus.INTERNAL_SERVER_ERROR, ex2.getMessage().getBytes()); |
| 625 | } |
| 626 | return null; |
| 627 | } |
| 628 | } |
| 629 | |
| 630 | /** |
nothing calls this directly
no test coverage detected