Skip to content

Commit

Permalink
Addressed PR Comments
Browse files Browse the repository at this point in the history
Signed-off-by: Ryan Bogan <rbogan@amazon.com>
  • Loading branch information
ryanbogan committed Jan 17, 2023
1 parent 703dc9d commit 61d44d3
Show file tree
Hide file tree
Showing 2 changed files with 21 additions and 3 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -408,7 +408,13 @@ public String executor() {
if (e.getCause() instanceof TimeoutException) {
logger.info("No response from extension to request.");
}
throw RuntimeException.class.cast(e.getCause());
if (e.getCause() instanceof RuntimeException) {
throw (RuntimeException) e.getCause();
} else if (e.getCause() instanceof Error) {
throw (Error) e.getCause();
} else {
throw new RuntimeException(e.getCause());
}
}
}

Expand Down Expand Up @@ -549,7 +555,13 @@ public String executor() {
if (e.getCause() instanceof TimeoutException) {
logger.info("No response from extension to request.");
}
throw RuntimeException.class.cast(e.getCause());
if (e.getCause() instanceof RuntimeException) {
throw (RuntimeException) e.getCause();
} else if (e.getCause() instanceof Error) {
throw (Error) e.getCause();
} else {
throw new RuntimeException(e.getCause());
}
}
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -181,7 +181,13 @@ public String executor() {
new BytesRestResponse(RestStatus.REQUEST_TIMEOUT, "No response from extension to request.")
);
}
throw RuntimeException.class.cast(cause);
if (e.getCause() instanceof RuntimeException) {
throw (RuntimeException) e.getCause();
} else if (e.getCause() instanceof Error) {
throw (Error) e.getCause();
} else {
throw new RuntimeException(e.getCause());
}
} catch (Exception ex) {
logger.info("Failed to send REST Actions to extension " + discoveryExtensionNode.getName(), ex);
return channel -> channel.sendResponse(new BytesRestResponse(RestStatus.INTERNAL_SERVER_ERROR, ex.getMessage()));
Expand Down

0 comments on commit 61d44d3

Please sign in to comment.