RejectedSoftware Forums

Sign up

Prevent REST stack trace

Is there a way to override the rest result when registering a REST
interface? I would like to only show the stack trace when the user has
certain rights, but any time any exception is thrown from a REST
interface, the REST subsystem puts out a message with a short
"statusMessage" and a trace in "statusDebugMessage".

-Steve

Re: Prevent REST stack trace

Am 24.02.2017 um 20:25 schrieb Steven Schveighoffer:

Is there a way to override the rest result when registering a REST
interface? I would like to only show the stack trace when the user has
certain rights, but any time any exception is thrown from a REST
interface, the REST subsystem puts out a message with a short
"statusMessage" and a trace in "statusDebugMessage".

-Steve

Right now this can only be changed by omitting the -debug option
during the build. Then only the message itself will be printed. But I
guess there should really be the possibility to register a callback,
similar to HTTPServerSettings.errorPageHandler, maybe even using a UDA
to be able to control this per endpoint. Any thoughts/preferences?

Re: Prevent REST stack trace

On 2/25/17 10:08 AM, Sönke Ludwig wrote:

Am 24.02.2017 um 20:25 schrieb Steven Schveighoffer:

Is there a way to override the rest result when registering a REST
interface? I would like to only show the stack trace when the user has
certain rights, but any time any exception is thrown from a REST
interface, the REST subsystem puts out a message with a short
"statusMessage" and a trace in "statusDebugMessage".

Right now this can only be changed by omitting the -debug option
during the build. Then only the message itself will be printed.

I still do want the stack trace in some circumstances, so that isn't an
option for me.

But I
guess there should really be the possibility to register a callback,
similar to HTTPServerSettings.errorPageHandler, maybe even using a UDA
to be able to control this per endpoint. Any thoughts/preferences?

I use errorPageHandler to check authority of getting stack trace when in
normal web code, so using that would fit right in. What would also be
awesome is if the rest system could just defer to errorPageHandler. My
current handler should work fine with rest, since all my rest routes
start with /rest, and that's how I tell whether to output an HTML page
or JSON. Note that I have some rest routes that aren't actual rest
objects, because rest has some deficiencies that I need to work around
(namely, having to serialize an entire query result into memory if
that's what you are streaming back to the client).

-Steve