Hi everyone,
I’m currently migrating an integration from OutSystems 11 to ODC, and I’ve encountered a change in how REST API errors are handled.
The Scenario: In O11, when the API returns a 400 Bad Request, I can easily access the response body (JSON) which contains specific error messages (e.g., "Invalid Voucher Code" or "Voucher Expired"). This allows the front-end to display a user-friendly message based on the actual reason for the failure.
The Issue in ODC: In ODC, whenever the API returns a 400 error, the platform seems to intercept it and returns a generic message:
"Error Executing Test. Http Error Code: 400 - Bad Request. Title: Bad Request"
Because of this, I lose the specific error details coming from the API provider (Voucherify), making it difficult to inform the users what exactly went wrong.
Questions:
Is there a way in ODC to prevent the platform from "masking" the 400 error body?
Do I need to use the OnAfterResponse callback to manually capture and parse the error response before ODC throws the exception?
Are there specific settings in the REST Integration or ODC portal to allow custom error messages to pass through?
Any insights or workarounds from those who have faced this in ODC would be greatly appreciated.
Thanks!
Hello,
I think this needs to be implemented manually within the OnAfterResponse callback.
You may refer to these links for further insights and assistance:
Hi Jesu,
you must use the OnAfterResponse callback to read the response before ODC converts it into a generic exception.
Regards,
good day sir sorry for super late repliy but im trying this approach may i ask how can i get the message bfore odc take that generic response? thanks!
In ODC, 4xx/5xx responses are treated as exceptions by default, which is why you’re seeing the generic "Error Executing…" message instead of the original response body.
To capture the actual 400 response body, you have two main options:
There is no setting in ODC to completely "unmask" the error automatically, handling it explicitly via OnAfterResponse is the recommended approach.
That’s currently the cleanest workaround in ODC.
Hope this helps.
Hi,
You should handle errors in the "On After Response" section. More detailed information will be provided there.
hello maybe im missing something been testing all in onafter response but still cant keep the message on the error message of api thanks! is there other way in after response?