Hello Rahul, Rhett

Throwing a ResourceException works fine on 2.0M4 too, with one small
glitch: the thrown ResourceException is catched by the framework and
the default action is to log the exception. So, if you don't mind
having exceptions and their stack traces logged, you can just throw
ResourceException(Status.WHATEVER_STATUS_HERE) and it will work.

The default "log exception and stack trace" behaviour can be overriden
by providing a different implementation for the doCatch() method.


On Tue, Sep 15, 2009 at 3:08 PM, Rhett Sutphin
<[email protected]> wrote:
> Hi Rahul,
>
> On Sep 15, 2009, at 9:00 AM, Rahul Juneja wrote:
>
>> I have a scenario in GET. Suppose i receive a request and there is
>> some error and i want to return 500 but i don;t want to return any
>> message with it instead just the error code. How can i do that. I
>> tried that by returning null in the representation but that give all
>> kind of exception trace on the server which is not what i wanted.
>>
>> I am using the following:
>>
>> @Get
>> public Representation get() {
>>
>>         //Something wrong here
>>         setStatus(Status.SERVER_ERROR_INTERNAL);
>>         return null;
>>
>> }
>>
>> Any clues or pointers on this is appreciated.
>
> Try throwing a ResourceException instead.  In 1.1 that works for
> setting all kinds of status codes.
>
> Rhett
>
> ------------------------------------------------------
> http://restlet.tigris.org/ds/viewMessage.do?dsForumId=4447&dsMessageId=2395194
>



-- 
Fabián Mandelbaum
IS Engineer

------------------------------------------------------
http://restlet.tigris.org/ds/viewMessage.do?dsForumId=4447&dsMessageId=2395210

Reply via email to