aboutsummaryrefslogtreecommitdiff
path: root/src/main/java/org/traccar/api
diff options
context:
space:
mode:
authorAnton Tananaev <anton.tananaev@gmail.com>2019-04-29 22:31:55 -0700
committerAnton Tananaev <anton.tananaev@gmail.com>2019-04-29 22:31:55 -0700
commit238f5d9b8b9e4819a9909a7403dcbc7bec0dc714 (patch)
tree883a7f71551876b5161857d73a9f428b3227f3b1 /src/main/java/org/traccar/api
parent35b902cd59070a7185d99640851b99798a0d1eb7 (diff)
downloadtraccar-server-238f5d9b8b9e4819a9909a7403dcbc7bec0dc714.tar.gz
traccar-server-238f5d9b8b9e4819a9909a7403dcbc7bec0dc714.tar.bz2
traccar-server-238f5d9b8b9e4819a9909a7403dcbc7bec0dc714.zip
Log exception root cause
Diffstat (limited to 'src/main/java/org/traccar/api')
-rw-r--r--src/main/java/org/traccar/api/ResourceErrorHandler.java12
1 files changed, 3 insertions, 9 deletions
diff --git a/src/main/java/org/traccar/api/ResourceErrorHandler.java b/src/main/java/org/traccar/api/ResourceErrorHandler.java
index 1d618b08d..108a8e8cc 100644
--- a/src/main/java/org/traccar/api/ResourceErrorHandler.java
+++ b/src/main/java/org/traccar/api/ResourceErrorHandler.java
@@ -1,5 +1,5 @@
/*
- * Copyright 2015 - 2016 Anton Tananaev (anton@traccar.org)
+ * Copyright 2015 - 2019 Anton Tananaev (anton@traccar.org)
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
@@ -26,14 +26,8 @@ public class ResourceErrorHandler implements ExceptionMapper<Exception> {
@Override
public Response toResponse(Exception e) {
if (e instanceof WebApplicationException) {
- WebApplicationException exception = (WebApplicationException) e;
- String message;
- if (exception.getCause() != null) {
- message = Log.exceptionStack(exception.getCause());
- } else {
- message = Log.exceptionStack(exception);
- }
- return Response.fromResponse(exception.getResponse()).entity(message).build();
+ WebApplicationException webException = (WebApplicationException) e;
+ return Response.fromResponse(webException.getResponse()).entity(Log.exceptionStack(webException)).build();
} else {
return Response.status(Response.Status.BAD_REQUEST).entity(Log.exceptionStack(e)).build();
}