Difference between RaiseException and Exception_Handler
Solution

Hi Jessica,

You may have realized that when you create a screen action, platform automatically places an Exception Handler that handles "All Exceptions". This is to catch all kinds of unexpected errors that may occur in the action.

You can create more exceptions with a name you like in the Logic/Exceptions folder, and then raise them as you like in the action. In the following example, I created a NoUserFound Exception, and put a handler for it next to the default AllExceptions handler. And I raise the NoUserFound Exception when the user I'm looking for is not present in the entity.

This way, I can tell the platform to do specific things (e.g log a specific type of error to an external system) according to the exception.

Ozan Cali wrote:

Hi Jessica,

You may have realized that when you create a screen action, platform automatically places an Exception Handler that handles "All Exceptions". This is to catch all kinds of unexpected errors that may occur in the action.

You can create more exceptions with a name you like in the Logic/Exceptions folder, and then raise them as you like in the action. In the following example, I created a NoUserFound Exception, and put a handler for it next to the default AllExceptions handler. And I raise the NoUserFound Exception when the user I'm looking for is not present in the entity.

This way, I can tell the platform to do specific things (e.g log a specific type of error to an external system) according to the exception.


Hi Ozan, 


Perfect!

I believe that you have essentially understood where and how I will use these two elements. I created a sketch, according to your example, to test it.
Thank you very much for your help and for the examples, they were indeed very informative.

Best Regards,
Jessica Marques. 




Glad to be of help, Jessica Marques!


Thanks for the explanation. 

mvp_badge
MVP

Hi Jessica,

Raise Exception is when you find an error and want to raise it.

Exception handler is to catch exceptions raised by you or the system and handle them gracefully.

Let me know if you need more information.

Regards,

Marcelo

Marcelo Ferreira wrote:

Hi Jessica,

Raise Exception is when you find an error and want to raise it.

Exception handler is to catch exceptions raised by you or the system and handle them gracefully.

Let me know if you need more information.

Regards,

Marcelo

Hi Marcelo, 


Honestly, I'm still confused, the raise exception is the main element that I have doubts in this case. Because in most of the flows I saw, the system generates an Exception handler, with the feedback message and the end, this element is outside the main flow, and as you said, it will catch exceptions raised by you or the system.
But what about the raise exception, when will I specifically use it? what is the difference in practice between "find an error" and "to catch exceptions"?

Could you give me a practical example of when I should use both?

Regards, 

Jessica. 


Solution

Hi Jessica,

You may have realized that when you create a screen action, platform automatically places an Exception Handler that handles "All Exceptions". This is to catch all kinds of unexpected errors that may occur in the action.

You can create more exceptions with a name you like in the Logic/Exceptions folder, and then raise them as you like in the action. In the following example, I created a NoUserFound Exception, and put a handler for it next to the default AllExceptions handler. And I raise the NoUserFound Exception when the user I'm looking for is not present in the entity.

This way, I can tell the platform to do specific things (e.g log a specific type of error to an external system) according to the exception.

Ozan Cali wrote:

Hi Jessica,

You may have realized that when you create a screen action, platform automatically places an Exception Handler that handles "All Exceptions". This is to catch all kinds of unexpected errors that may occur in the action.

You can create more exceptions with a name you like in the Logic/Exceptions folder, and then raise them as you like in the action. In the following example, I created a NoUserFound Exception, and put a handler for it next to the default AllExceptions handler. And I raise the NoUserFound Exception when the user I'm looking for is not present in the entity.

This way, I can tell the platform to do specific things (e.g log a specific type of error to an external system) according to the exception.


Hi Ozan, 


Perfect!

I believe that you have essentially understood where and how I will use these two elements. I created a sketch, according to your example, to test it.
Thank you very much for your help and for the examples, they were indeed very informative.

Best Regards,
Jessica Marques. 




Glad to be of help, Jessica Marques!


Thanks for the explanation. 

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