show custom error message
Question
Application Type
Reactive

Hello community I am new to Outsytems . I wanted to know,

how to  show custom error message in REST API response timeout.

mvp_badge
MVP

Hi Sarah,


I presume you are consuming a REST API service, right?

In that case, you will need to add an onAfterResponse handler to your web service:


In here, you will be able to check the output of the service you call like the HTTP code and exception message, so you can control the exception message.

For instance, in the example below, I check if the HTTP status code returned was 408 (which is the standard used for Request Timeout) and if it is I throw an exception with a message of my liking:



Finally, I leave you here with a great article on how to handle HTTP status codes and exceptions when consuming REST APIs in OutSystems: How to Handle HTTP Status Codes When Consuming a REST API in OutSystems 


Kind Regards,
João

thanks a lot for your answer

Community GuidelinesBe kind and respectful, give credit to the original source of content, and search for duplicates before posting.