Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Incorrect username/password crashes program #3

Open
nerdenough opened this issue Oct 26, 2015 · 0 comments
Open

Incorrect username/password crashes program #3

nerdenough opened this issue Oct 26, 2015 · 0 comments

Comments

@nerdenough
Copy link

Using an incorrect username/password in the config causes the following error to occur:

SyntaxError: Unexpected end of input
    at Object.parse (native)
    at restCallbackHandler (...\node_modules\servicenow\servicenow.js:291:18)
    at Request._callback (...\node_modules\servicenow\servicenow.js:142:9)
    at Request.self.callback (...\node_modules\servicenow\node_modules\request\request.js:121:22)
    at emitTwo (events.js:87:13)
    at Request.emit (events.js:172:7)
    at Request.<anonymous> (...\node_modules\servicenow\node_modules\request\request.js:978:14)
    at emitOne (events.js:82:20)
    at Request.emit (events.js:169:7)
    at IncomingMessage.<anonymous> (...\node_modules\servicenow\node_modules\request\request.js:929:12)

npm ERR! Windows_NT 6.3.9600
npm ERR! argv "C:\\Program Files\\nodejs\\node.exe" "C:\\Program Files\\nodejs\\node_modules\\npm\\bin\\npm-cli.js" "start"
npm ERR! node v4.1.2
npm ERR! npm  v2.14.4
npm ERR! code ELIFECYCLE
npm ERR! start: `node app.js`
npm ERR! Exit status 1
npm ERR!
npm ERR! Failed at the start script 'node app.js'.
npm ERR! This is most likely a problem with the package,
npm ERR! not with npm itself.
npm ERR! Tell the author that this fails on your system:
npm ERR!     node app.js
npm ERR! You can get their info via:
npm ERR!     npm owner ls ...
npm ERR! There is likely additional logging output above.

npm ERR! Please include the following file with any support request:
npm ERR!     ...\npm-debug.log

I found that adding in a status code check into the restCallbackHandler function, similar to that in your jsonServiceErrorProcessor function fixed the issue.

e.g. something like:

if (response.statusCode != 200) {
    callback(response);
    return;
}

Placing that in the servicenow.js just before JSON.parse(body) on line 291 fixes the problem.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant