Core: Throw better errors for bad rule methods

99% of type errors in this situation are misspelled rules, so be
specific in the throw

Closes #1395
This commit is contained in:
Ryley Breiddal
2015-02-04 19:01:57 -08:00
committed by Jörn Zaefferer
parent e88f2ef98a
commit f3b1e415cf

View File

@@ -632,6 +632,10 @@ $.extend( $.validator, {
if ( this.settings.debug && window.console ) {
console.log( "Exception occurred when checking element " + element.id + ", check the '" + rule.method + "' method.", e );
}
if ( e instanceof TypeError ) {
e.message += ". Exception occurred when checking element " + element.id + ", check the '" + rule.method + "' method.";
}
throw e;
}
}