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

Better error handling when the JSON file uses invalid quotes #386

Open
RonWang opened this issue Mar 9, 2021 · 0 comments
Open

Better error handling when the JSON file uses invalid quotes #386

RonWang opened this issue Mar 9, 2021 · 0 comments

Comments

@RonWang
Copy link
Contributor

RonWang commented Mar 9, 2021

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
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

2 participants