Fabian, Rhett,
I did try this throwing ResourceException but as Fabian said it has stack
trace thrown by the framework.

As I don;t want to see such stack traces in my logs. I will try to override
doCatch(throwable th) in my ServerResource file and let you know how it
works.

Thanks,
Rahul


On Tue, Sep 15, 2009 at 2:54 PM, Fabian Mandelbaum <[email protected]>wrote:

> 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
>



-- 
Rahul Juneja
Phone : (631) 681-9996
Fax :  (206) 339-9047
http://techlabs.thoughtclicks.com
http://finance.thoughtclicks.com
---------------------------------------------------------------------------
The thing always happens that you really believe in;
and the belief in a thing makes it happen.

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

Reply via email to