Skip to content

Commit

Permalink
Better error logs.
Browse files Browse the repository at this point in the history
  • Loading branch information
noboomu committed Apr 28, 2020
1 parent 544668f commit aad21cf
Show file tree
Hide file tree
Showing 2 changed files with 17 additions and 7 deletions.
5 changes: 5 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,11 @@ Proteus Changelog.
## Unreleased
### No issue

**Added multipart/form-data media type.**


[544668fabf96683](https://github.com/noboomu/proteus/commit/544668fabf96683) Joshua Bauer *2020-03-30 23:14:29*

**Set version to 4.5 for release**


Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -72,17 +72,24 @@ public boolean handleDefaultResponse(HttpServerExchange exchange)
{
ServerException serverException = (ServerException) throwable;
exchange.setStatusCode(serverException.getStatus());
statusCode = serverException.getStatus();


} else if (throwable instanceof IllegalArgumentException) {
exchange.setStatusCode(StatusCodes.BAD_REQUEST);
}



errorMap.put("exceptionClass", throwable.getClass().getName());
errorMap.put("message", throwable.getMessage());
errorMap.put("path", path);
errorMap.put("code", Integer.toString(statusCode));
errorMap.put("code", Integer.toString(exchange.getStatusCode()));

log.error("\n\tmessage: " + throwable.getMessage() + "\n\tpath: " + path, throwable);

if (throwable.getStackTrace() != null) {
if (throwable.getStackTrace() != null && exchange.getStatusCode() >= 500 ) {

log.error("path: " + path, throwable);

if (throwable.getStackTrace().length > 0) {
errorMap.put("className", throwable.getStackTrace()[0].getClassName());
}
Expand All @@ -101,9 +108,7 @@ public boolean handleDefaultResponse(HttpServerExchange exchange)
}
}

if (throwable instanceof IllegalArgumentException) {
exchange.setStatusCode(StatusCodes.BAD_REQUEST);
}


if (ServerPredicates.ACCEPT_XML_EXCLUSIVE_PREDICATE.resolve(exchange)) {
try {
Expand Down

0 comments on commit aad21cf

Please sign in to comment.