Is there a recommend approach for dealing with errors on the server side?
This way of doing it seems quite verbose:
if (method.equals("getUsers")) {
try {
List<UserInfoDTO> users = getUsers(null);
MessageBuilder.createConversation(message)
.toSubject("Users").signalling()
.with("action", "initUsers")
.with("users", users)
.errorsHandledBy(new ErrorCallback() {
public boolean error(Message message, Throwable throwable) {
System.err.println("Error responding with retrieving
users.");
return false;
}
})
.sendNowWith(bus);
} catch (DatabaseException e) {
MessageBuilder.createConversation(message)
.toSubject("UsersView").signalling()
.with("action", "error")
.with("error", e)
.errorsHandledBy(new ErrorCallback() {
public boolean error(Message message, Throwable throwable) {
System.err.println("Error responding with retrieving
users.");
return false;
}
})
.sendNowWith(bus);
}
}
I was looking in the example code for the preferred way of handling errors but none of the
examples have much. At first I thought maybe it was the errorsHandledBy(...) but that
seems like more about communications errors than responding to a specific request that
resulted in an error.
Thanks,
Chris