• Global community
    • Language:
      • Deutsch
      • English
      • Español
      • Français
      • Português
  • 日本語コミュニティ
    Dedicated community for Japanese speakers
  • 한국 커뮤니티
    Dedicated community for Korean speakers
Exit
Locked
0

Need more info about "AlertShow" violation

Explorer ,
Sep 10, 2009 Sep 10, 2009

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!

TOPICS
FlexPMD

Views

4.5K

Translate

Translate

Report

Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines

correct answers 1 Correct answer

Adobe Employee , Sep 10, 2009 Sep 10, 2009

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

Votes

Translate

Translate
Adobe Employee ,
Sep 10, 2009 Sep 10, 2009

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

Votes

Translate

Translate

Report

Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
Community Beginner ,
Apr 13, 2011 Apr 13, 2011

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?

Votes

Translate

Translate

Report

Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
Guest
Apr 13, 2011 Apr 13, 2011

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?

Votes

Translate

Translate

Report

Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
Community Beginner ,
Apr 13, 2011 Apr 13, 2011

Copy link to clipboard

Copied

LATEST

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

Votes

Translate

Translate

Report

Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines