Handle exception message individiually

Handle exception message individiually

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?
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.
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.

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.

Miguel Vieira
The idea was not to have to do that in all places where we need to catch an exception
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...