Souldn't transport errors hanled on the bus level instead doing
message by meesage? I.e by registering a global error handler with the
bus? At least for reception errors (it's asyc). Errors that happen
when sending messages could cause an unchecked exception that may
catch, but it's not mandatory. If they do fine, if not the same global
error handler for dealing with errors that happen when receiving
messages can deal with it.
IMO that would redruce the amount of code a lot, but still provide
sufficient error handling hooks. Or am missing something?
On Mar 10, 2010, at 5:00, Mike Brock <cbrock(a)redhat.com> wrote:
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
_______________________________________________
errai-users mailing list
errai-users(a)lists.jboss.org
https://lists.jboss.org/mailman/listinfo/errai-users