This content has been marked as final.
Show 2 replies
-
1. Re: Web app only detect “unexpected status code” in development mode?
csa Aug 8, 2012 11:07 AM (in response to ckrog)It's intentional that the error popup only shows up in development mode. In production mode, errors are logged to your browsers JavaScript console. But in any case, the ErrorCallback you specified should be notified. Global errors (like a wrong response code during long polling) are sent to a special subject on the bus: DefaultErrorCallback.CLIENT_ERROR_SUBJECT
-
2. Re: Web app only detect “unexpected status code” in development mode?
ckrog Aug 9, 2012 2:45 AM (in response to csa)Thanks for your response.
I have just made a second attempt, and the sample code below shows the alert dialog when I'm using Internet Explorer but NOT in Google Chrome…?
@Override public void onModuleLoad() { messageBus.addPostInitTask(new Runnable() { @Override public void run() { ErraiBus.get().subscribe(DefaultErrorCallback.CLIENT_ERROR_SUBJECT, defaultErrorCallback); } }); }
private MessageCallback defaultErrorCallback = new MessageCallback() { @Override public void callback(Message message) { try { caught = message.get(Throwable.class, MessageParts.Throwable); throw caught; } catch(TransportIOException e) { // TODO: This dialog does not show up in Chrome. Do work in IE?! Window.alert("server can't be reached or an unexpected status code was returned..."); } catch (Throwable throwable) { Window.alert("...should never happen :)"); } } };