🐛 Add missing non JSON ask error handling #1609
Merged
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Proposed Changes
Provoking an error in alexa ask deployment sometimes results in an error in the
getAskError
function.Example:
Using a non existent ask profile like so:
This leads to the
stderr
:The current version of
getAskError
tries to parse the substring after[Error]
, in this case this textCan't resolve profile [does-not-exist] as it doesn't exist. Please run "ask configure --profile does-not-exist" first.
. As this clearly is no JSON object/array. ThisJSON.parse
throws an error resulting in this being displayed after runningjovo deploy:platform alexa
:This is why I built a block to catch the error from
JSON.parse
, which creates theJovoCliError
in a different way, leading to the actual helpful error message being displayed after running the jovo deploy, in this case:As this further increased the size of the function I also refactored some logic into its own function
getViolation
to improve readability.Types of Changes
Checklist