Landister
Landister

Reputation: 2224

How to keep Javascript from breaking

Is there a way to keep one bad Javascript call from breaking my entire code base? Right now, if someone in my app makes a bad Javascript call, then the script in the rest of the application stops working.

Upvotes: 0

Views: 91

Answers (2)

Justin Ethier
Justin Ethier

Reputation: 134177

You can use Exception Handling to attempt to work around this problem - in particular, try and catch. That would be most effective if there are particular areas of the application that are fragile and that seem to break most often.

But this might just be a symptom of a larger problem. If you find that your application is broken on a regular basis, the problem could lie with your development process. Perhaps you need to develop functional/unit tests, test your application more rigorously prior to deployment, understand why individual developers are not fixing their own mistakes (or "releasing" so many in the first place), etc.

Upvotes: 5

Konstantin Dinev
Konstantin Dinev

Reputation: 34905

Yeah wrap the code in:

try {

} catch (e) {

}

Upvotes: -2

Related Questions