Skip to content

Commit f3b1e41

Browse files
ryleybjzaefferer
authored andcommitted
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 jquery-validation#1395
1 parent e88f2ef commit f3b1e41

File tree

1 file changed

+4
-0
lines changed

1 file changed

+4
-0
lines changed

src/core.js

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -632,6 +632,10 @@ $.extend( $.validator, {
632632
if ( this.settings.debug && window.console ) {
633633
console.log( "Exception occurred when checking element " + element.id + ", check the '" + rule.method + "' method.", e );
634634
}
635+
if ( e instanceof TypeError ) {
636+
e.message += ". Exception occurred when checking element " + element.id + ", check the '" + rule.method + "' method.";
637+
}
638+
635639
throw e;
636640
}
637641
}

0 commit comments

Comments
 (0)