Skip to content
This repository has been archived by the owner on Oct 30, 2018. It is now read-only.

Commit

Permalink
Catching and printing error after calling binders' init/bind method, …
Browse files Browse the repository at this point in the history
…this prevents binders from interfering with each other and also ensures that the mojito-client finishes processing everything.
  • Loading branch information
aljimenez committed Jun 19, 2014
1 parent 42cc294 commit 5a9f312
Showing 1 changed file with 15 additions and 4 deletions.
19 changes: 15 additions & 4 deletions lib/app/autoload/mojito-client.client.js
Expand Up @@ -137,7 +137,11 @@ YUI.add('mojito-client', function(Y, NAME) {

if (Y.Lang.isFunction(binder.bind)) {
// Pass the "node" to the bind method
binder.bind(node, element);
try {
binder.bind(node, element);
} catch (e) {
Y.log(e.stack || e.message, 'error');
}
}
// all automatic event delegation
if (Y.Lang.isFunction(binder.handleClick)) {
Expand Down Expand Up @@ -641,11 +645,14 @@ YUI.add('mojito-client', function(Y, NAME) {
});

if (Y.Lang.isFunction(binder.init)) {
binder.init(mojitProxy);
try {
binder.init(mojitProxy);
} catch (e) {
Y.log(e.stack || e.message, 'error');
}
}

onBinderComplete();

});

}, this);
Expand Down Expand Up @@ -1018,7 +1025,11 @@ YUI.add('mojito-client', function(Y, NAME) {
if (Y.Lang.isFunction(childBinder.onRefreshView)) {
childBinder.onRefreshView(childNode, childElement);
} else if (Y.Lang.isFunction(childBinder.bind)) {
childBinder.bind(childNode, childElement);
try {
childBinder.bind(childNode, childElement);
} catch (e) {
Y.log(e.stack || e.message, 'error');
}
}
});

Expand Down

0 comments on commit 5a9f312

Please sign in to comment.