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

Make client:auth more robust when login url cannot be reached #29

Closed
tobiaslohr opened this issue Apr 10, 2019 · 0 comments
Closed

Make client:auth more robust when login url cannot be reached #29

tobiaslohr opened this issue Apr 10, 2019 · 0 comments
Assignees
Labels
enhancement New feature or request

Comments

@tobiaslohr
Copy link
Contributor

In some cases, when the login url of the authorization server (the Account Manager) cannot be reached, an exception is thrown and the command sfcc-ci client:auth does not gracefully print an error message but prints the stack trace to the console:

./node_modules/sfcc-ci/cli.js client:auth **** **** 

.../node_modules/sfcc-ci/lib/auth.js:235 } else if ( res.body && res.body['error_description']) { ^ TypeError: Cannot read property 'body' of undefined at Request._callback (.../node_modules/sfcc-ci/lib/auth.js:235:24) 
at self.callback (.../node_modules/request/request.js:185:22) 
at emitOne (events.js:96:13) 
at Request.emit (events.js:188:7) 
at Request.onRequestError (.../node_modules/request/request.js:881:8) 
at emitOne (events.js:96:13) 
at ClientRequest.emit (events.js:188:7) 
at TLSSocket.socketErrorListener (_http_client.js:314:9) 
at emitOne (events.js:96:13) 
at TLSSocket.emit (events.js:188:7)

Suggestion is the check on the response object being available and fallback to the err message passed to the callback function of the request module.

@tobiaslohr tobiaslohr added the enhancement New feature or request label Apr 10, 2019
@tobiaslohr tobiaslohr self-assigned this Apr 10, 2019
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or request
Projects
None yet
Development

No branches or pull requests

1 participant