Skip to content

Commit

Permalink
fix(cli): avoid crash with circular references in error details
Browse files Browse the repository at this point in the history
  • Loading branch information
edvald committed Apr 4, 2019
1 parent 35ad3df commit 92b31c0
Showing 1 changed file with 7 additions and 2 deletions.
9 changes: 7 additions & 2 deletions garden-service/src/logger/renderers.ts
Original file line number Diff line number Diff line change
Expand Up @@ -96,8 +96,13 @@ export function renderError(entry: LogEntry) {
acc[kebabCase(key)] = val
return acc
}, {})
const yamlDetail = yaml.safeDump(kebabCasedDetail, { noRefs: true, skipInvalid: true })
out += `\nError Details:\n${yamlDetail}`

try {
const yamlDetail = yaml.safeDump(kebabCasedDetail, { noRefs: true, skipInvalid: true })
out += `\nError Details:\n${yamlDetail}`
} catch (err) {
out += `\nUnable to render error details:\n${err.message}`
}
}
return out
}
Expand Down

0 comments on commit 92b31c0

Please sign in to comment.