Showing feedback message from producer module

Hi, 

I have a consumer module(Module A) that has a dependency of a producer module(Module B) that consumes an API. The UI resides in the Module A. When I click a button in Module A it calls a server action in Module B. This server action calls the API. So, when I get a 500 internal error from API. The control goes to exception handler inside Module B. Exception handler inside Module A where the server action call resides is not called.
So, I need to show a custom feedback in UI when 500 internal error is caught inside Module B.
Please help.

Thanks,

Sundeep.

Hi Sandeep,

This is a similar case which you want handel.

https://www.outsystems.com/forums/discussion/62146/throw-an-exception-to-another-module/ 

follow this link with solution.


let me know if you have any other problems.

Hope this will help you.

Regards

Rahul Sahu

Solution

Hi Sundeep,

You could either:

  • Create an output parameter ErrorMessage for the server action of Module B (the one that calls the API) and assign the caught error message to that output parameter inside the Exception Handler flow. This way you could pass the error message on to the consumer Module A.

Or you can:

  • Raise a new exception with the same error message inside that server action in Module B which you could then handle in Module A.

Hope this helps.

Regards,

Nordin

Solution

Nordin Ahdi wrote:

Hi Sundeep,

You could either:

  • Create an output parameter ErrorMessage for the server action of Module B (the one that calls the API) and assign the caught error message to that output parameter inside the Exception Handler flow. This way you could pass the error message on to the consumer Module A.

Or you can:

  • Raise a new exception with the same error message inside that server action in Module B which you could then handle in Module A.

Hope this helps.

Regards,

Nordin

 Hi Nordin,

The second solution worked for me. I raised an exception. Now I want to show a custom error message in the Global exception handler of Module A.Using your above solution now the control is reaching Global Exception Handler and I placed a feedback message there. But it is not showing the feedback message.

Any work around for this?

Thanks
Sundeep.

 

Hi Sundeep,

The feedback won’t show from the Global Exception Handler. That is not possible afaik.

From Module A inside the screen action that is bound to your button and calls the server action from Module B, you could add an exception handler that catches the raised exception (from Module B) and displays the error message using a feedback message that needs to be added within that same exception handler flow.

Regards,

Nordin