Skip to content
Browse files

Ref #2531679 - Removed throwFail check from Y.error

  • Loading branch information...
1 parent 427d3f6 commit b092a4bb7bb6a74510917f92444610615dc268e3 @davglass committed Apr 18, 2012
Showing with 20 additions and 2 deletions.
  1. +1 −1 src/yui/js/yui.js
  2. +19 −1 src/yui/tests/core-tests.js
View
2 src/yui/js/yui.js
@@ -1160,7 +1160,7 @@ Y.log('Fetching loader: ' + config.base + config.loaderPath, 'info', 'yui');
ret = Y.config.errorFn.apply(Y, arguments);
}
- if (Y.config.throwFail && !ret) {
+ if (!ret) {
throw (e || new Error(msg));
} else {
Y.message(msg, 'error', ''+src); // don't scrub this one
View
20 src/yui/tests/core-tests.js
@@ -39,7 +39,8 @@ YUI.add('core-tests', function(Y) {
name: "Core tests",
_should: {
error: {
- test_attach_error: true
+ test_attach_error: true,
+ test_attach_error_errFn: true
},
ignore: {
'getLocation() should return the location object': Y.UA.nodejs,
@@ -409,6 +410,23 @@ YUI.add('core-tests', function(Y) {
}
}).use('attach-error');
},
+ test_attach_error_errFn: function() {
+ /*
+ As of 3.6.0 this should throw an error as
+ setting throwFail: false will supress the error and
+ errorFn returns false see #2531679
+ */
+ var Assert = Y.Assert;
+ YUI.add('attach-error', function() { Y.push(); });
+
+ YUI({
+ throwFail: false,
+ errorFn: function(str) {
+ Assert.isTrue(str.indexOf('attach-error') > -1, 'Failed to fire errorFn on attach error');
+ return false;
+ }
+ }).use('attach-error');
+ },
test_attach_after: function() {
var Assert = Y.Assert;
YUI.add('after-test', function(Y) {

0 comments on commit b092a4b

Please sign in to comment.
Something went wrong with that request. Please try again.