diff options
author | Jon Marius Venstad <venstad@gmail.com> | 2020-10-01 20:28:19 +0200 |
---|---|---|
committer | Jon Marius Venstad <venstad@gmail.com> | 2020-10-01 20:28:19 +0200 |
commit | 7983d163ea4fe9154b2abc79185e38c70dcf11a3 (patch) | |
tree | 86e3e7b62b5f6de912d7ff1e91f801cd7ccc3897 /vespaclient-container-plugin | |
parent | e332801e60491ab10dd0cd4fb124c3ee8fc0e1a5 (diff) |
Revert "Catch Throwable instead of just RuntimeException"
This reverts commit 75cafe646fbbbf9ba65021d65e2bb6afd1c4d156.
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 fb06991f2df..135b6a824c8 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 (Throwable t) { - context.error(ERROR, Exceptions.toMessageString(t)); + 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 ef5cd0a81ce..98bbb029ea8 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 (Throwable t) { - return serverError(request, t, responseHandler); + catch (RuntimeException e) { + return serverError(request, e, responseHandler); } } @@ -250,8 +250,8 @@ public class DocumentV1ApiHandler extends AbstractRequestHandler { } } // TODO jonmv: This shouldn't happen much, but ... expose errors too? - catch (Throwable t) { - log.log(WARNING, "Exception serializing document in document/v1 visit response", t); + catch (RuntimeException e) { + log.log(WARNING, "Exception serializing document in document/v1 visit response", e); } }); } @@ -296,8 +296,8 @@ public class DocumentV1ApiHandler extends AbstractRequestHandler { catch (IllegalArgumentException e) { badRequest(request, e, handler); } - catch (Throwable t) { - serverError(request, t, handler); + catch (RuntimeException e) { + serverError(request, e, handler); } }); } @@ -318,8 +318,8 @@ public class DocumentV1ApiHandler extends AbstractRequestHandler { catch (IllegalArgumentException e) { badRequest(request, e, handler); } - catch (Throwable t) { - serverError(request, t, handler); + 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); } |