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

fix: display all property when printing error #334

Merged
merged 1 commit into from
Nov 10, 2020

Conversation

kakhaUrigashvili
Copy link
Contributor

@kakhaUrigashvili kakhaUrigashvili commented Nov 9, 2020

Fixing issue when some of the error properties are not shown when outputting error to console.

example
ask smapi update-skill-manifest -s amzn1.ask.skill.fcb348d9-a177-4891-8e43-5a10d30e3e38 -g development --manifest file:TestSkill.json

TestSkill.json has properties that violate server side validation.

Before

[Error]: {
  "message": "Server cannot process the request due to a client error.",
  "stack": "ServiceError: Server cannot process the request due to a client error.\n    at SkillManagementServiceClient.<anonymous> (/Users/kakuri/Git/ask-cli-v2/node_modules/ask-sdk-model-runtime/dist/index.js:335:31)\n    at step (/Users/kakuri/Git/ask-cli-v2/node_modules/ask-sdk-model-runtime/dist/index.js:58:23)\n    at Object.next (/Users/kakuri/Git/ask-cli-v2/node_modules/ask-sdk-model-runtime/dist/index.js:39:53)\n    at fulfilled (/Users/kakuri/Git/ask-cli-v2/node_modules/ask-sdk-model-runtime/dist/index.js:30:58)\n    at processTicksAndRejections (internal/process/task_queues.js:94:5)"
}

After

[Error]: {
  "message": "Server cannot process the request due to a client error.",
  "stack": "ServiceError: Server cannot process the request due to a client error.\n    at SkillManagementServiceClient.<anonymous> (/Users/kakuri/Git/ask-cli-v2/node_modules/ask-sdk-model-runtime/dist/index.js:335:31)\n    at step (/Users/kakuri/Git/ask-cli-v2/node_modules/ask-sdk-model-runtime/dist/index.js:58:23)\n    at Object.next (/Users/kakuri/Git/ask-cli-v2/node_modules/ask-sdk-model-runtime/dist/index.js:39:53)\n    at fulfilled (/Users/kakuri/Git/ask-cli-v2/node_modules/ask-sdk-model-runtime/dist/index.js:30:58)\n    at processTicksAndRejections (internal/process/task_queues.js:94:5)",
  "detail": {
    "name": "ServiceError",
    "statusCode": 400,
    "headers": [
      {
        "key": "content-type",
        "value": "application/json"
      },
.....
    ],
    "response": {
      "message": "Skill manifest is not valid.",
      "violations": [
        {
          "code": "INVALID_DATA_TYPE",
          "message": "Instance at property path \"$.manifest.apis.smartHome.protocolVersion\" of type \"integer\" does not match any allowed primitive types [\"string\"].",
          "validationDetails": {
            "allowedDataTypes": [
              "string"
            ],
            "originalInstance": {
              "dataType": "integer",
              "propertyPath": "$.manifest.apis.smartHome.protocolVersion",
              "type": "BODY"
            }
          }
        },
        {
          "code": "INVALID_ENUM_VALUE",
          "message": "String instance at property path \"$.manifest.apis.smartHome.protocolVersion\" has invalid enum value: \"3\". Please refer to public documentation for the list of allowed values.",
          "validationDetails": {
            "originalInstance": {
              "dataType": "string",
              "propertyPath": "$.manifest.apis.smartHome.protocolVersion",
              "type": "BODY",
              "value": "3"
            }
          }
        },
        {
          "code": "INVALID_DATA_TYPE",
          "message": "Instance at property path \"$.manifest.publishingInformation.isAvailableWorldwide\" of type \"string\" does not match any allowed primitive types [\"boolean\"].",
          "validationDetails": {
            "allowedDataTypes": [
              "boolean"
            ],
            "originalInstance": {
              "dataType": "string",
              "propertyPath": "$.manifest.publishingInformation.isAvailableWorldwide",
              "type": "BODY"
            }
          }
        }
      ]
    }
  

lib/view/json-view.js Outdated Show resolved Hide resolved
@kakhaUrigashvili kakhaUrigashvili merged commit b562325 into develop Nov 10, 2020
@RonWang RonWang deleted the add-error-info branch February 8, 2021 23:22
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

Successfully merging this pull request may close these issues.

2 participants