It's all about the answers!

Ask a question

How to return exceptions - ITeamModelledRestService


Vibha Sinha (1643610) | asked Jan 13 '09, 3:37 p.m.
Hello,

I had written a repository component in Jazz and also implemented services to get/set the data in that component. The service extends ITeamModelledRestService class.

I need to return exceptions to the client (exception code and stack trace or some descriptive message). What is the best way to do so.

Currently, the client is returned a http 500 error code and no further details.

Thanks
- Vibha

2 answers



permanent link
Vibha Sinha (1643610) | answered Jan 13 '09, 4:43 p.m.
The exception is accessible at client side if you set the request header as -
Accept: text/json

The exception details are available using:
HttpURLConnection.getErrorStream

Also, seems like the exception that is thrown needs to be an instance of or subclass of TeamRepositoryException. Is this correct ?

Thanks
- Vibha

permanent link
Matt Lavin (2.7k2) | answered Jan 14 '09, 8:28 a.m.
FORUM MODERATOR / JAZZ DEVELOPER
I just glanced at the code, and it looks like any subclass of Exception
will be marshaled back to the caller. Did you see an exception type
that did not get sent back?

-
Matt Lavin
Jazz Server Team


On Tue, 2009-01-13 at 21:47 +0000, vssinha wrote:
The exception is accessible at client side if you set the request
header as -
Accept: text/json

The exception details are available using:
HttpURLConnection.getErrorStream

Also, seems like the exception that is thrown needs to be an instance
of or subclass of TeamRepositoryException. Is this correct ?

Thanks
- Vibha

Your answer


Register or to post your answer.