542
Views
6
Comments
Handle exception message individiually
Question
Hi all.
 
I need to handle the text shown in the various exceptions individually. I know this can be done using the error handler but with that method I would have to put this differentiation in each screen which is impractical. Also there is no specific handler to timeout errors, for example.
Is there any way to distinguish in a single action the type of exception that occurred in order to show different error text for each one?
2016-04-21 20-09-55
J.
 
MVP
Interesting question.

I'm assuming you want to have a feedback-message.
I think you are stuck with placing some keyword in the Message itself and call your action with inpu-parameter the session.exceptionMessage and work from there.

Furthermore I suggest to put your idea in the Ideas as well, because it could be handy for more applications.
2019-09-27 09-46-34
Patrícia Lopes
I had a very small hope that someone had already faced this issue and arranged a stable solution but I supose it's just a nice to have.

Thank you for the suggestion.
UserImage.jpg
22bc63ff-d68c-4193-824e-d79d2714f8b3
Hi,

Not sure about your question, but if you catch the exception you can set the feedback message you want, deal with the exception, treat it and the native exception error will not occur, because it was already "fixed" by a previous action you designed.

Regards,
Miguel Vieira
2019-09-27 09-46-34
Patrícia Lopes
The idea was not to have to do that in all places where we need to catch an exception
2020-03-19 14-14-27
Pedro Gonçalves
Staff
Hi folks,
 
I'm currently designing an exception handling framework for a project, and my question was very similar to Patrícia's. It still needs to be placed on all screen actions of your web screen, but here's how it was solved:

First, your screen action needs 3 exception handling flows (AllExceptions, Database Exception and a User Exception - this one named 'UnmappedException' in my case)

[suggestion: you may want to right-click over each image below and open them in separate browser tabs; they're a bit wide...]

 
Then, the Database Exception handling flow will use a ExceptionHandler action (named TratarExcecao in my case) to map each database exception to friendlier messages to end-users:



This design allows:
- individual control of exception messages and their friendly output;
- control of exception logging (to avoid polluting Service Center Error Logs with unnecessary messages);
 
However, this design still lacks:
- traceability of the uncontrolled exception (since the Database Exception Handling in this design no longer logs the message by default);
 
Any idea of how to fix the above issue? I have a feeling that .NET's HTTPContext or similar classes would help me here...
 
Thanks!
UserImage.jpg
AC

Pedro Gonçalves wrote:

Hi folks,
 
I'm currently designing an exception handling framework for a project, and my question was very similar to Patrícia's. It still needs to be placed on all screen actions of your web screen, but here's how it was solved:

First, your screen action needs 3 exception handling flows (AllExceptions, Database Exception and a User Exception - this one named 'UnmappedException' in my case)

[suggestion: you may want to right-click over each image below and open them in separate browser tabs; they're a bit wide...]

 
Then, the Database Exception handling flow will use a ExceptionHandler action (named TratarExcecao in my case) to map each database exception to friendlier messages to end-users:



This design allows:
- individual control of exception messages and their friendly output;
- control of exception logging (to avoid polluting Service Center Error Logs with unnecessary messages);
 
However, this design still lacks:
- traceability of the uncontrolled exception (since the Database Exception Handling in this design no longer logs the message by default);
 
Any idea of how to fix the above issue? I have a feeling that .NET's HTTPContext or similar classes would help me here...
 
Thanks!

  HI  Pedro Gonçalves,

Do you have any sample application for this. because  i also want to implement same functionality.

Thanks

A.  



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