Prefer throwing a new Error object instead of just a string expression

This commit is contained in:
kleinfreund
2018-06-05 16:43:45 +02:00
committed by Sam
parent 0997eb6486
commit 4ce1d230c7
19 changed files with 35 additions and 29 deletions

View File

@ -1,12 +1,12 @@
function checkSelectKitIsNotExpanded(selector) {
if (find(selector).hasClass('is-expanded')) {
throw 'You expected select-kit to be collapsed but it is expanded.';
throw new Error('You expected select-kit to be collapsed but it is expanded.');
}
}
function checkSelectKitIsNotCollapsed(selector) {
if (!find(selector).hasClass('is-expanded')) {
throw 'You expected select-kit to be expanded but it is collapsed.';
throw new Error('You expected select-kit to be expanded but it is collapsed.');
}
}