Yes, I unerstand what you are saying. That seems perfect, thanks. But why does 
it work without having declared any throws clause in the interface service 
method?

> Date: Wed, 29 Jul 2009 17:14:37 +0100
> From: [email protected]
> To: [email protected]
> Subject: Re: Handling servre side exceptions and displaying precise error 
> messages  on the client
> 
> 
> Catch all exceptions in the server, and throw a new exception in its
> place that the client can handle. You might like to create an exception
> class, put that into the throws clause, then then only throw that class
> or subclasses of it.
> 
> try {
>   doSomething();
> } catch (QueryParseException qpe) {
>   throw new MyException(qpe.getMessage());
> }
> 
> Gerasimos Tzoganis wrote:
> > Thanks a lot.
> > The problem is that I can't put a throw clause in the service
> > interface method (on the client side), because the exceptions I am
> > interesting in are not part of gwt, but of the jena API (so there will
> > be the error :
> > [ERROR] Line 19: No source code is available for type
> > com.hp.hpl.jena.query.QueryParseException; did you forget to inherit a
> > required module?)
> >
> > But I threw the exception only on the service implementation method,
> > without prior declaration in the interface method) and that seems to
> > work so far. I hope this will do.
> >
> > > Date: Wed, 29 Jul 2009 16:36:57 +0100
> > > From: [email protected]
> > > To: [email protected]
> > > Subject: Re: Handling servre side exceptions and displaying precise
> > error messages on the client
> > >
> > >
> > > If you're using RPC, then you should make sure that your server will
> > > only throw exceptions that are declared in the throws cause of the
> > > service interface method (or exceptions that are a subtype of whatever
> > > is declared).
> > >
> > > This means catching exceptions server-side and re-throwing an
> > > appropriate exception, as well as making sure there's a throws clause on
> > > your service interface methods.
> > >
> > > Gerasimos Tzoganis wrote:
> > > > No one has an answer to this?
> > > > It is part of my application to show to the user exactly the error, eg
> > > > because perhaps he has submitted a misformed query, like in the error
> > > > log I have atached. Can't I get this somehow to te client side?
> > > >
> > > > > Date: Tue, 28 Jul 2009 16:00:45 -0700
> > > > > Subject: Handling servre side exceptions and displaying precise
> > > > error messages on the client
> > > > > From: [email protected]
> > > > > To: [email protected]
> > > > >
> > > > >
> > > > > I am trying to create an application using jena API and gwt. How
> > can I
> > > > > get an exception from the server log displayed on the client? To be
> > > > > more specific: Right now I get on the client the standard message of
> > > > > unexpected exceptions
> > > > > "com.google.gwt.user.client.rpc.StatusCodeException: The call failed
> > > > > on the server; see server log for details".
> > > > >
> > > > > On the server log:
> > > > > [WARN] StandardContext[]Exception while dispatching incoming RPC
> > call
> > > > > com.google.gwt.user.server.rpc.UnexpectedException: Service method
> > > > > 'public abstract java.lang.String
> > > > > com.diplomatiki.mypackage.client.MyService.myMethod2
> > > > > (java.lang.String,java.lang.String)' threw an unexpected exception:
> > > > > com.hp.hpl.jena.query.QueryParseException: Lexical error at line 1,
> > > > > column 10. Encountered: <EOF> after : "dfasfFSFS"
> > > > >
> > > > > ...
> > > > > ...
> > > > >
> > > > > Caused by: com.hp.hpl.jena.query.QueryParseException: Lexical
> > error at
> > > > > line 1, column 10. Encountered: <EOF> after : "dfasfFSFS"
> > > > > at
> > com.hp.hpl.jena.sparql.lang.ParserSPARQL.perform(ParserSPARQL.java:
> > > > > 95)
> > > > > at com.hp.hpl.jena.sparql.lang.ParserSPARQL.parse(ParserSPARQL.java:
> > > > > 39)
> > > > > at com.hp.hpl.jena.query.QueryFactory.parse(QueryFactory.java:129)
> > > > > at com.hp.hpl.jena.query.QueryFactory.create(QueryFactory.java:72)
> > > > > at com.hp.hpl.jena.query.QueryFactory.create(QueryFactory.java:43)
> > > > > at com.hp.hpl.jena.query.QueryFactory.create(QueryFactory.java:31)
> > > > >
> > > > > I want to display the actual error on the client side (or even
> > better
> > > > > a description of my own), is that possible?
> > > > >
> > > > > I have read the documentation and found no way to do this. I
> > searched
> > > > > the forum and there was a solution based on serializableexception,
> > > > > which is deprecated now.
> > > > >
> > > > > Please help me with this one, I would appreciate it much.
> > > > >
> > > > > Thanks,
> > > > > Gerasimos
> > > > >
> > > > >
> > > > >
> > >
> > >
> > >
> 
> > 

_________________________________________________________________
Έχετε Messenger; Έχετε και Windows Live. Μάθετε περισσότερα.
http://microsoft.com/windows/windowslive
--~--~---------~--~----~------------~-------~--~----~
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
-~----------~----~----~----~------~----~------~--~---

Reply via email to