Skip to content

Commit

Permalink
For #659 - show more descriptive error message when sending command f…
Browse files Browse the repository at this point in the history
…ails
  • Loading branch information
vitalidze committed May 6, 2016
1 parent 99131ba commit f9d1a36
Showing 1 changed file with 10 additions and 2 deletions.
12 changes: 10 additions & 2 deletions src/main/java/org/traccar/web/server/model/DataServiceImpl.java
Original file line number Diff line number Diff line change
Expand Up @@ -1086,11 +1086,19 @@ public String sendCommand(Command command) throws AccessDeniedException {
sendCommand.invoke(activeDevice, backendCommand);
}
}
} catch (ClassNotFoundException | NoSuchMethodException | InvocationTargetException
| IllegalAccessException | InstantiationException | JsonProcessingException e) {
} catch (ClassNotFoundException | NoSuchMethodException | IllegalAccessException
| InstantiationException | JsonProcessingException e) {
log("Unable to invoke command through reflection", e);
result.put("success", false);
result.put("reason", e.getClass().getName() + ": " + e.getLocalizedMessage());
} catch (InvocationTargetException ite) {
log("Error invoking command through reflection", ite);
result.put("success", false);
if (ite.getCause() == null) {
result.put("reason", ite.getClass().getName() + ": " + ite.getLocalizedMessage());
} else {
result.put("reason", ite.getCause().getClass().getName() + ": " + ite.getCause().getLocalizedMessage());
}
}

try {
Expand Down

0 comments on commit f9d1a36

Please sign in to comment.