Proper error message for undefined where options (#1022)

When user provides a knex select statement with an undefined options in where clause it is not properly handled an give an ambiguous error message telling `Unhandled rejection TypeError: Cannot read property 'toString' of undefined.` This PR will helpful to users at it will tell them the exact problem.
This commit is contained in:
Muhammad Raihan Muhaimin 2016-06-07 17:04:52 -04:00 committed by Brian C
parent edf4e7f76c
commit 667953fd5c

View File

@ -48,6 +48,9 @@ var prepareValue = function(val, seen) {
if(typeof val === 'object') {
return prepareObject(val, seen);
}
if (typeof val === 'undefined') {
throw new Error('SQL queries with undefined where clause option');
}
return val.toString();
};