You are correct, the errorsHandledBy() is used for transport related errors, and does not
currently receive exceptions thrown from the server automatically. The approach
you're taking right now, if you wish to push errors back to the client is currently
the best approach.
However, we will be improving this in the next update (within the next few weeks).
On 2010-03-09, at 3:37 PM, Christopher Gokey wrote:
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
_______________________________________________
errai-users mailing list
errai-users(a)lists.jboss.org
https://lists.jboss.org/mailman/listinfo/errai-users