How to return exceptions - ITeamModelledRestService
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
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
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
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
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:
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