Nexmo / nexmo-cli

Nexmo CLI (Command Line Interface)
https://nexmo.com
MIT License
78 stars 52 forks source link

"Cannot read property" error when deleting applications #154

Closed kyooryoo closed 6 years ago

kyooryoo commented 6 years ago

Steps to reproduce

delete an application, such as: nexmo ad fd134757-d269-47dd-bcd8-f4dc634f1fcc --confirm

Expected behavior

returns "Application deleted"

Actual behavior

/usr/local/lib/node_modules/nexmo-cli/lib/validator.js:46 } else if (_response['error-code'] && _response['error-code'] !== '200') { ^

TypeError: Cannot read property 'error-code' of null at Validator.response (/usr/local/lib/node_modules/nexmo-cli/lib/validator.js:46:27) at Response.applicationDelete (/usr/local/lib/node_modules/nexmo-cli/lib/response.js:213:22) at HttpClient.__parseResponse (/usr/local/lib/node_modules/nexmo-cli/node_modules/nexmo/lib/HttpClient.js:172:9) at IncomingMessage. (/usr/local/lib/node_modules/nexmo-cli/node_modules/nexmo/lib/HttpClient.js:101:19) at emitNone (events.js:72:20) at IncomingMessage.emit (events.js:166:7) at endReadableNT (_stream_readable.js:905:12) at nextTickCallbackWith2Args (node.js:441:9) at process._tickCallback (node.js:355:17)

System configuration

Node version: 4.2.6

NPM version: 3.5.2

Operating system: Ubuntu 16.04.03 LST

kyooryoo commented 6 years ago

I added "_response" to the following two if clauses and it seems solved the problem on my computer else if (_response && _response['error-code'] && _response['error-code'] !== '200') { this.emitter.error(_response['error-code-label']); } else if (_response && _response['status'] && _response['status'] !== '0') { this.emitter.error(_response['status_message']); }

AlexLakatos commented 6 years ago

Thanks for letting us know @kyooryoo. I'll have a look myself and add the _response safeguard in there.

AlexLakatos commented 6 years ago

Thanks for logging this issue. It has now been fixed in v0.3.11.