Improved Response Structure for Client Errors in the CLI and SMAPI

Leo Ohannesian Aug 30, 2019
Share:
Tips & Tools Advanced News
Blog_Header_Post_Img

Today, we are excited to announce the improvements in error responses that you receive for skill development related operations in the CLI and SMAPI; error responses for failed operations of create skill, build model, deploy skill, update skill, publish skill etc. Error responses are now more standard in metadata, more detailed, and more actionable, saving you time in debugging.

Error Responses Are Now Standardized and Actionable

Earlier, error messages contained disparate metadata which led to inconsistency across various failed operations that you performed. Error responses are now standardized around three mandatory keys - code, message, and validationDetails. The validationDetails is further broken down into more keys such as originalInstance, allowedDataTypes, and more. With these changes errors are more structured, consistent and understandable. Below is a before and after an error code related to an invalid data type in skill manifest's publishing information:

Before

Copied to clipboard
{
"error": {
"message": "Invalid data type in skill manifest."
}
}

After

Copied to clipboard
{
"error": {
"code": "INVALID_DATA_TYPE",
"message": "Instance at property path\ "$.manifest.publishingInformation.distributionCountries\" of type \"string\" does not match any allowed primitive types [\"array\"].",

"validationDetails": {
"originalInstance": {
"propertyPath": "$.manifest.publishingInformation.distributionCountries",
"dataType": "string"
},
"allowedDataTypes": [
"array"
]
}
}
}

The new error code structure is live on the CLI and SMAPI today. In order to further understand the new error code structure, read up about it in our docs.