Permalink
Browse files

Avoid wrapping the mod.fn and Y.use callback method with try/catch to…

… get reasonable stacktrace.
  • Loading branch information...
1 parent 5cbb744 commit 27b292e77c1cb73384e5b45e55717f5dea643ab7 @opichals committed Jan 17, 2012
Showing with 8 additions and 1 deletion.
  1. +8 −1 src/yui/js/yui.js
View
@@ -688,7 +688,9 @@ with any configuration info required for the module.
}
}
- if (mod.fn) {
+ if (mod.fn && Y.config.throwFail) {
+ mod.fn(Y, name);
+ } else if (mod.fn) {
try {
mod.fn(Y, name);
} catch (e) {
@@ -823,6 +825,11 @@ with any configuration info required for the module.
if (!response.success && this.config.loadErrorFn) {
this.config.loadErrorFn.call(this, this, callback, response, args);
} else if (callback) {
+ if (this.config.throwFail) {
+ callback(this, response);
+ return;
+ }
+
try {
callback(this, response);
} catch (e) {

0 comments on commit 27b292e

Please sign in to comment.