Skip to content

Commit

Permalink
Handle error returning error
Browse files Browse the repository at this point in the history
  • Loading branch information
ianopolous committed Jul 12, 2023
1 parent 5c64188 commit a9a4d04
Showing 1 changed file with 1 addition and 1 deletion.
2 changes: 1 addition & 1 deletion src/main/java/org/peergos/util/HttpUtil.java
Original file line number Diff line number Diff line change
Expand Up @@ -47,7 +47,7 @@ public static void replyError(HttpExchange exchange, Throwable t) {
try {
Logging.LOG().log(Level.WARNING, t.getMessage(), t);
Throwable cause = t.getCause();
if (cause != null)
if (cause != null && cause.getMessage() != null)
exchange.getResponseHeaders().set("Trailer", URLEncoder.encode(cause.getMessage(), "UTF-8"));
else
exchange.getResponseHeaders().set("Trailer", URLEncoder.encode(t.getMessage(), "UTF-8"));
Expand Down

0 comments on commit a9a4d04

Please sign in to comment.