Skip to content
This repository has been archived by the owner on Jul 3, 2024. It is now read-only.

Commit

Permalink
- Search API: validate require arguments
Browse files Browse the repository at this point in the history
  • Loading branch information
danieljoppi committed Oct 20, 2015
1 parent 2071b13 commit c313386
Showing 1 changed file with 3 additions and 2 deletions.
5 changes: 3 additions & 2 deletions lib/nsfunc/search-api/search-record.js
Original file line number Diff line number Diff line change
Expand Up @@ -87,8 +87,9 @@ var validateColumns = (meta, columns) => {
* @since 2007.0
*/
exports.nlapiSearchRecord = (type, id, filters, columns) => {
if (!type) throw nlapiCreateError('SSS_TYPE_ARG_REQD');
if (id && typeof id !== 'number' && isNaN(id = parseInt(id))) {
if (!type) {
throw nlapiCreateError('SSS_TYPE_ARG_REQD');
} else if (id && typeof id !== 'number' && isNaN(id = parseInt(id))) {
throw nlapiCreateError('SSS_INVALID_INTERNAL_ID');
}
// if no exists throw error
Expand Down

0 comments on commit c313386

Please sign in to comment.