Methods defined in the Async interface should not throw exceptions
(otherwise you have to surround them by a try catch bloc when using it
in your client code) and must have void return types :
public void getName(int id,AyncCallback);
instead of
public String getName(int id,AyncCallback) throws ClientException;
I did not encounter any problem while retrieving exception messages in
onFailure method.
How do you use your service ?
On Sep 2, 8:49 am, ping2ravi <[EMAIL PROTECTED]> wrote:
> My class definition is like......
> public Class ClientException extends Exception
> {
> public ClientException()
> {
> super();
> }
> public ClientException(String message)//I am using this constructor
> {
> super(message);
> }
> public ClientException(Throwable ex)
> {
> super(ex);
> }
>
> }
>
> On Sep 1, 7:17 pm, Folke <[EMAIL PROTECTED]> wrote:
>
> > What does your ClientException look like? Do you call the superclass'
> > constructor? super(msg);?
>
> > On Sep 1, 7:16 pm, ping2ravi <[EMAIL PROTECTED]> wrote:
>
> > > No replies :( :(
>
> > > On Aug 30, 10:16 am, ping2ravi <[EMAIL PROTECTED]> wrote:
>
> > > > Hi All,
> > > > I am having a problem in getting exception messages from exception in
> > > > onFailure method.
>
> > > > My services are like
>
> > > > //Client Side
> > > > public String getName(int id) throws ClientException;
>
> > > > public String getName(int id,AyncCallback) throws ClientException;
>
> > > > //Server Side
> > > > public String getName(int id) throws ClientException
> > > > {
> > > > ...
> > > > ..
> > > > //on some condition i am throwing ClientException
> > > > throw new ClientException("You can not do this operation");
>
> > > > }
>
> > > > Now onFailure method i just want to pop this error message in alert;
>
> > > > So
> > > > void onFailure(Throwable t)
> > > > {
> > > > Window.alert(t.toString);// This line gives me
> > > > com.app.exceptions.ClientException which is my class.
> > > > Window.alert(t.getMessage);// this line gives me null
> > > > Window.alert(t.getLocalizedMessage);// this line gives me null
>
> > > > }
>
> > > > So is there any way to get the error message which i put into
> > > > ClientException at server side.
>
> > > > Thanks in advance,
> > > > Ravi
--~--~---------~--~----~------------~-------~--~----~
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
-~----------~----~----~----~------~----~------~--~---