I've encountered the same problem. Intuition says that throwing an error should trigger the onFailure() method, not the onSuccess() method with a SEVERE logging the exception. Is this a known bug?
On Nov 6, 5:03 am, Henrique F M <[email protected]> wrote: > Hi there, > > I didn't find the solution to this anywhere, so I'm creating this new > discussion. > > I want to be able to send errors from my RequestFactory to the client. > Let me give an example: let's say my app is a simple Person CRUD. My > Person class has a String name attribute and I don't want to have more > than two Persons with the same name. So i was thinking something like > this: > > ---------- RequestFactory Server Implementation -------- > public static Person createNewPerson(String name){ > .... > if( isThereAnotherPersonWithThisName(name) ){ > > //do something HERE > > }else{ > pm.makePersistent(person); > } > ... > > } > > ------ Client --------------- > (....).fire( > new Receiver<Person>() { > @Override > public void onSuccess(Person person) { > Window.alert("OK!"); > //do stuff > } > @Override > public void onFailure(ServerFailure error) { > Window.alert("Fail!"); > Window.alert(error.getMessage()); > //do stuff > } > }); > > -------------------- > I don't know what I have to do on HERE to make my Receiver go to > onFailure. I've tried to throw Exceptions, RequestException, but it > only make my server log the error and the response never arrives to > the client. > Am I missing something here? What would you suggest? > > Thanks -- You received this message because you are subscribed to the Google Groups "Google Web Toolkit" group. To post to this group, send email to [email protected]. To unsubscribe from this group, send email to [email protected]. For more options, visit this group at http://groups.google.com/group/google-web-toolkit?hl=en.
