On Sun, 28 Jan 2018 13:45:25 GMT, Andrew Chapman wrote:

Hi everyone!

When using the rest generator, is it possible to catch instances of HTTPStatusException and to change the handling / output or this error?

In my code I might have something like this:

catch (Exception exception) {
    throw new HTTPStatusException(400, exception.msg)
}

Which causes the rest interface to generate a response output like this:

{
    "statusMessage": "Expected status 221 in response to QUIT, got 500:  unrecognized command"
}

I want to control this output and put the exception message in my own structure.

I've tried using the error HTTPServerSettings.errorPageHandler to do this, however it seems these kinds of exceptions are not handled by it.

Any ideas?

Hi and sorry for the late reply. Currently not all of the exceptions can be intercepted. I've opened a PR to add a REST specific error handler to RestInterfaceSettings: #2072