Skip to content

Commit

Permalink
Display response errors and unknown failures.
Browse files Browse the repository at this point in the history
Signed-off-by: Achim Kraus <[email protected]>
  • Loading branch information
boaks committed Sep 21, 2022
1 parent 4239276 commit c3b6666
Showing 1 changed file with 37 additions and 0 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -1309,6 +1309,43 @@ public void onResponse(Response response) {
}
super.onResponse(response);
}

@Override
public void onResponseHandlingError(Throwable error) {
Platform.runLater(() -> {
if (resetCurrentRequest(request)) {
LOG.info("response error", error);
mediaTypeView.setImage(blank);
String text = error.getMessage();
if (text == null) {
text = error.getClass().getSimpleName();
}
responseTitle.setText("Response: Receive Error");
responseArea.setText(text);
responseArea.setPromptText("Response receive error.");
if (connect.get()) {
connectionArea.setText("");
}
}
});
super.onResponseHandlingError(error);
}

@Override
protected void failed() {
Platform.runLater(() -> {
if (resetCurrentRequest(request)) {
LOG.info("failed");
responseTitle.setText("Response: Failed");
responseArea.setText("");
responseArea.setPromptText("Unknown reason.");
if (connect.get()) {
connectionArea.setText("");
}
}
});
}

}

public static String logMessage(Request request, Exception ex) {
Expand Down

0 comments on commit c3b6666

Please sign in to comment.