I'm using a REST API method to POST something to it. I programmed it to always give a response with the HTTP status code (like 200 or 400 etc) and a message. However, if the REST method in OutSystems returns an exception, I never get to see the status code in the response, because the method never arrives at the breakpoint. Even when I turn the option "break on all exceptions" and remove the exception handler in the method, I still can't see the error message. How can I resolve this?

Hi Joeri,

I did a quick test, and this is what I found:

  1. When not having a Exception Handler in the Action that calls the REST Method, with the debugger on, Service Studio stops with a pop-up displaying the Exception Message.
  2. When having an Exception Handler and the same setup, Service Studio does not stop and instead executes the Exception Handler.
  3. Both behaviours are also seen when single-stepping through the code.

So either "Break On All Exceptions" should be renamed to "Break On All Unhandled Exceptions", or it should actually break.

I cannot reproduce your scenario though, but your description is a bit vague ("the method never arrives at the breakpoint" - what breakpoint?).

Hi Joeri,

You should make the exception handler for this case. So you can intercept the exception and set the status code and message with the exception message trigerred by OutSystems.

I tried it with the OnAfterResponse callback, and that worked (for now). I will check out the other options you guys mentioned so that I can finetune my solution. Thanks for the responses!