aboutsummaryrefslogtreecommitdiff
path: root/src/org/traccar/http/BaseServlet.java
diff options
context:
space:
mode:
Diffstat (limited to 'src/org/traccar/http/BaseServlet.java')
-rw-r--r--src/org/traccar/http/BaseServlet.java6
1 files changed, 5 insertions, 1 deletions
diff --git a/src/org/traccar/http/BaseServlet.java b/src/org/traccar/http/BaseServlet.java
index 122dbe70b..be4b41631 100644
--- a/src/org/traccar/http/BaseServlet.java
+++ b/src/org/traccar/http/BaseServlet.java
@@ -70,7 +70,11 @@ public abstract class BaseServlet extends HttpServlet {
public void sendResponse(Writer writer, Exception error) throws IOException {
JsonObjectBuilder result = Json.createObjectBuilder();
result.add("success", false);
- result.add("error", error.getMessage());
+ if (error.getMessage() != null) {
+ result.add("error", error.getMessage());
+ } else {
+ result.add("error", error.getClass().getSimpleName());
+ }
writer.write(result.build().toString());
}