John Jai
John Jai

Reputation: 3723

Global try catch for extjs

Is it possible to surround the entire ext-js based code, as a global try - catch. Something like having the ext-application javascript file, so that not every function should be surrounded with a try-catch?

Upvotes: 0

Views: 5665

Answers (2)

Neil McGuigan
Neil McGuigan

Reputation: 48256

Sure, like this:

try {
  Ext.application({
    launch:function(){

    }
  });
} catch(err){
  alert(err.message);
}

What is wrong with the solution in your previous question?

You will still want to use try/catch in other areas though, when you need to handle exceptional situations.

Your other catch blocks should re-throw the exception after handling them.

Upvotes: 1

Vlad
Vlad

Reputation: 3645

window.onerror is a handler catching all error events and sending them to the window.

Upvotes: 2

Related Questions