diff options
author | Jon Marius Venstad <venstad@gmail.com> | 2020-10-02 15:33:11 +0200 |
---|---|---|
committer | Jon Marius Venstad <venstad@gmail.com> | 2020-10-02 15:33:11 +0200 |
commit | 23cb6ef2bdbef00d32d836072bfc47ff8f5682de (patch) | |
tree | 12840601328a8edcab91ebb901ba290d23f11208 /vespaclient-container-plugin | |
parent | a0334edd0177249a36c493a9e73b190ea911f062 (diff) |
Catch errors no more
Diffstat (limited to 'vespaclient-container-plugin')
2 files changed, 8 insertions, 8 deletions
diff --git a/vespaclient-container-plugin/src/main/java/com/yahoo/document/restapi/DocumentOperationExecutorImpl.java b/vespaclient-container-plugin/src/main/java/com/yahoo/document/restapi/DocumentOperationExecutorImpl.java index ad01295b4e6..72e28d15e4b 100644 --- a/vespaclient-container-plugin/src/main/java/com/yahoo/document/restapi/DocumentOperationExecutorImpl.java +++ b/vespaclient-container-plugin/src/main/java/com/yahoo/document/restapi/DocumentOperationExecutorImpl.java @@ -221,7 +221,7 @@ public class DocumentOperationExecutorImpl implements DocumentOperationExecutor catch (IllegalArgumentException | ParseException e) { context.error(BAD_REQUEST, Exceptions.toMessageString(e)); } - catch (RuntimeException | LinkageError e) { + catch (RuntimeException e) { context.error(ERROR, Exceptions.toMessageString(e)); } } diff --git a/vespaclient-container-plugin/src/main/java/com/yahoo/document/restapi/resource/DocumentV1ApiHandler.java b/vespaclient-container-plugin/src/main/java/com/yahoo/document/restapi/resource/DocumentV1ApiHandler.java index c056fe46e01..f85805ab4af 100644 --- a/vespaclient-container-plugin/src/main/java/com/yahoo/document/restapi/resource/DocumentV1ApiHandler.java +++ b/vespaclient-container-plugin/src/main/java/com/yahoo/document/restapi/resource/DocumentV1ApiHandler.java @@ -166,7 +166,7 @@ public class DocumentV1ApiHandler extends AbstractRequestHandler { catch (IllegalArgumentException e) { return badRequest(request, e, responseHandler); } - catch (RuntimeException | LinkageError e) { + catch (RuntimeException e) { return serverError(request, e, responseHandler); } } @@ -250,7 +250,7 @@ public class DocumentV1ApiHandler extends AbstractRequestHandler { } } // TODO jonmv: This shouldn't happen much, but ... expose errors too? - catch (RuntimeException | LinkageError e) { + catch (RuntimeException e) { log.log(WARNING, "Exception serializing document in document/v1 visit response", e); } }); @@ -296,7 +296,7 @@ public class DocumentV1ApiHandler extends AbstractRequestHandler { catch (IllegalArgumentException e) { badRequest(request, e, handler); } - catch (RuntimeException | LinkageError e) { + catch (RuntimeException e) { serverError(request, e, handler); } }); @@ -318,7 +318,7 @@ public class DocumentV1ApiHandler extends AbstractRequestHandler { catch (IllegalArgumentException e) { badRequest(request, e, handler); } - catch (RuntimeException | LinkageError e) { + catch (RuntimeException e) { serverError(request, e, handler); } }); @@ -423,10 +423,10 @@ public class DocumentV1ApiHandler extends AbstractRequestHandler { return respond(Response.Status.TOO_MANY_REQUESTS, root, handler); } - private static ContentChannel serverError(HttpRequest request, Throwable t, ResponseHandler handler) { - log.log(WARNING, "Uncaught exception handling request " + request.getMethod() + " " + request.getUri().getRawPath() + ":", t); + private static ContentChannel serverError(HttpRequest request, RuntimeException e, ResponseHandler handler) { + log.log(WARNING, "Uncaught exception handling request " + request.getMethod() + " " + request.getUri().getRawPath() + ":", e); Cursor root = responseRoot(request); - root.setString("message", Exceptions.toMessageString(t)); + root.setString("message", Exceptions.toMessageString(e)); return respond(Response.Status.INTERNAL_SERVER_ERROR, root, handler); } |