ask-cli
ask-cli copied to clipboard
Better error handling when the JSON file uses invalid quotes
I'm submitting a...
[ ] Regression (a behavior that used to work and stopped working in a new release)
[x] Bug report
[ ] Performance issue
[ ] Feature request
[ ] Documentation issue or request
[ ] Other... Please describe:
Expected Behavior
The error message should be better, telling users the JSON file is invalid.
Current Behavior
$ ask smapi create-skill-for-vendor --manifest file:x.json
/Users/ask-cli/lib/commands/smapi/before-send-processor.js:31
this.paramsObject[bodyParam.name].vendorId = vendorId;
^
TypeError: Cannot create property 'vendorId' on string '{
“manifest“: {
...
}
}'
at BeforeSendProcessor.appendVendorId (/Users/ask-cli/lib/commands/smapi/before-send-processor.js:31:60)
at BeforeSendProcessor.processAll (/Users/ask-cli/lib/commands/smapi/before-send-processor.js:12:14)
...
The JSON file is written using curly quotes, but it's read by CLI as a string... ideally it should be a parsing error.
$ cat x.json
{
“manifest“: {
“apis“: {
“custom“: {}
},
“manifestVersion“: “1.0“,
“locales“: {
“en-US“: {
“description“: “Sample Full Description“,
“examplePhrases“: [
“Alexa open hello world“,
“hello“,
“help“
],
“keywords“: [],
“name“: “Test Skill“,
“summary“: “Sample Short Description“
}
},
}
}
}
Your Environment and Context
- ask-cli version:2.22.4
- Operating System and version: MACOS