diff options
author | Jon Marius Venstad <venstad@gmail.com> | 2020-10-01 19:51:47 +0200 |
---|---|---|
committer | Jon Marius Venstad <venstad@gmail.com> | 2020-10-01 19:51:47 +0200 |
commit | 75cafe646fbbbf9ba65021d65e2bb6afd1c4d156 (patch) | |
tree | 94235e789f690f96caddf28e7d750945df105a0e /vespaclient-container-plugin | |
parent | a80b6cb19619821ce4d354aff12937d2b4557919 (diff) |
Catch Throwable instead of just RuntimeException
Diffstat (limited to 'vespaclient-container-plugin')
2 files changed, 13 insertions, 13 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 135b6a824c8..fb06991f2df 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,8 +221,8 @@ public class DocumentOperationExecutorImpl implements DocumentOperationExecutor catch (IllegalArgumentException | ParseException e) { context.error(BAD_REQUEST, Exceptions.toMessageString(e)); } - catch (RuntimeException e) { - context.error(ERROR, Exceptions.toMessageString(e)); + catch (Throwable t) { + context.error(ERROR, Exceptions.toMessageString(t)); } } 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 98bbb029ea8..ef5cd0a81ce 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,8 +166,8 @@ public class DocumentV1ApiHandler extends AbstractRequestHandler { catch (IllegalArgumentException e) { return badRequest(request, e, responseHandler); } - catch (RuntimeException e) { - return serverError(request, e, responseHandler); + catch (Throwable t) { + return serverError(request, t, responseHandler); } } @@ -250,8 +250,8 @@ public class DocumentV1ApiHandler extends AbstractRequestHandler { } } // TODO jonmv: This shouldn't happen much, but ... expose errors too? - catch (RuntimeException e) { - log.log(WARNING, "Exception serializing document in document/v1 visit response", e); + catch (Throwable t) { + log.log(WARNING, "Exception serializing document in document/v1 visit response", t); } }); } @@ -296,8 +296,8 @@ public class DocumentV1ApiHandler extends AbstractRequestHandler { catch (IllegalArgumentException e) { badRequest(request, e, handler); } - catch (RuntimeException e) { - serverError(request, e, handler); + catch (Throwable t) { + serverError(request, t, handler); } }); } @@ -318,8 +318,8 @@ public class DocumentV1ApiHandler extends AbstractRequestHandler { catch (IllegalArgumentException e) { badRequest(request, e, handler); } - catch (RuntimeException e) { - serverError(request, e, handler); + catch (Throwable t) { + serverError(request, t, 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, RuntimeException e, ResponseHandler handler) { - log.log(WARNING, "Uncaught exception handling request " + request.getMethod() + " " + request.getUri().getRawPath() + ":", e); + private static ContentChannel serverError(HttpRequest request, Throwable t, ResponseHandler handler) { + log.log(WARNING, "Uncaught exception handling request " + request.getMethod() + " " + request.getUri().getRawPath() + ":", t); Cursor root = responseRoot(request); - root.setString("message", Exceptions.toMessageString(e)); + root.setString("message", Exceptions.toMessageString(t)); return respond(Response.Status.INTERNAL_SERVER_ERROR, root, handler); } |