Note that there are some explanatory texts on larger screens.

plurals
  1. POGWT Exception changes on Client Side
    text
    copied!<p>I want to send a exception which are thrown on the server side to the client side. ATM it works partial.</p> <p>When a method from my <code>DatabaseServerConnectionImpl</code> fails, I save the exception, then the client detects (onFailure) that the method has failed and returns the previously saved exception with a further callback.</p> <p>This exception now contains a message and a stacktrace. The message is the right one, but the stacktrace is wrong. I checked the stack trace on the server side before the return command and it was the right one. For Example (on the server side) :</p> <pre><code>org.postgresql.core.v3.QueryExecutorImpl.receiveErrorResponse(QueryExecutorImpl.java:2077) </code></pre> <p>On the client side the exception later looks like :</p> <pre><code>com.google.gwt.user.client.rpc.core.java.lang.Exception_FieldSerializer.instantiate(Exception_FieldSerializer.java:16) and it has a different length </code></pre> <p>When I create the exception I just set the message and the stacktrace. And afaik the exception is default serialized. The other method on the server side are working without any problems. Edit : Add some Source Code : A example method from DatabaseServerConnectionImpl The lastexception is a member value ! ...</p> <pre><code>try { database.doStuff(obj); } catch (SQLException e) { Logger.getInstance().log(e); // Logs the Errors lastException = new Exception(e.getMessage()); StackTraceElement[] tmp = new StackTraceElement[e.getStackTrace().length]; for (int i = 0; i &lt; tmp.length; i++) { tmp[i] = e.getStackTrace()[i]; } lastException.setStackTrace(tmp); throw new IllegalArgumentException(); } </code></pre> <p>When the asynchronous callback fails on the client side, i call the following method on the server side : </p> <p>@Override public final SerializableException getLatestException() {</p> <pre><code> return lastException; } </code></pre> <p>I tried the method above also with an try and catch block , but not exception was caught.</p>
 

Querying!

 
Guidance

SQuiL has stopped working due to an internal error.

If you are curious you may find further information in the browser console, which is accessible through the devtools (F12).

Reload