Copy link to clipboard
Copied
Hello,
First of all thanks for the great tool! It was really something we all missed.
I have a question related to the "AlertShow" violation. I got several such violations and the description says
"Do not call Alert.show directly.. You should not Alert.show() directly. If an error occurred in the system, you should probably use an ErrorManager to have a consistent way to manage those errors".
What exactly was meant by this violation? Could you, please provide more details why this violation pops up and how it is expected to be fixed.
Thank you!
Hi,
Glad you liked the project.
So we often people using Alert.show whithout having a central ErrorManager class. Having such a class allows you to have a consistent way to deal with errors in your application.
Alert.show can be called from anywhere (view, model, commands, ...), whereas it is nothing else than a wrapped view.
I hope this helps.
Xavier
Copy link to clipboard
Copied
Hi,
Glad you liked the project.
So we often people using Alert.show whithout having a central ErrorManager class. Having such a class allows you to have a consistent way to deal with errors in your application.
Alert.show can be called from anywhere (view, model, commands, ...), whereas it is nothing else than a wrapped view.
I hope this helps.
Xavier
Copy link to clipboard
Copied
PMD found these Alerts in my code too. I fail to see what is wrong with that.
What would an ErrorManager do more than report the error and wait for OK to know that the user saw it?
What to do after the error depends entirely on the place the error occurred, and
cannot be dealt with in a general way. Except maybe for logging it for later examination. Is that what you mean?
Copy link to clipboard
Copied
Using Alerts all over the place can have lots of drawbacks:
1. They are not good from a unit testing perspective, it's very hard to make assertions based on alerts. An Alert itself should not be used directly to specify errors. Otherwise, and highly likely, in a testrunner you'll end up having a ton of alerst one on top of the other without the ability to assert the expected behaviour
2. Normally applications have a centralized way to present messages or errors to the user. Allowing developers to simply allow the usage of Alerts will highly imply that when there's an error multiple alerts appear one on top of hte other.
3. Using or referencing an Alert from a model is not a "permitted" relationship. A PM or model shouldn't refernece the view, the view should reference the model (not hte other way arround).
does this make sense?
Copy link to clipboard
Copied
I see what you mean: I've had multiple alerts on top of the other as well.
But as I am relatively new to flex, I do not know how to go about setting
up an ErrorManager class.
What would it do to fix the problems you are addressing?
I have searched in the Adobe documentation (and google) for ErrorManager,
but apparently its use
is not that widespread to have found its way into that documentation and
examples.
Please point me to an example?
Jan