Skip to content

Commit

Permalink
Node v14 compat for errors reporting
Browse files Browse the repository at this point in the history
  • Loading branch information
tbeseda committed Oct 19, 2023
1 parent 4e0b437 commit fc3d376
Show file tree
Hide file tree
Showing 2 changed files with 2 additions and 2 deletions.
2 changes: 1 addition & 1 deletion src/_read.cjs
Original file line number Diff line number Diff line change
Expand Up @@ -38,7 +38,7 @@ module.exports = async function read ({ scope = 'apps', token, appID, envID, pat
// tiny 7 reads do NOT parse JSON errors; see tiny#37
const { error, errors } = JSON.parse(err.body)
if (error) throw Error(error)
if (errors) throw Error(Array.isArray(errors) ? errors.at(-1) : errors)
if (errors) throw Error(Array.isArray(errors) ? errors[errors.length - 1] : errors)
else throw Error('unknown_error')
}
else {
Expand Down
2 changes: 1 addition & 1 deletion src/_write.cjs
Original file line number Diff line number Diff line change
Expand Up @@ -39,7 +39,7 @@ module.exports = async function write ({ scope = 'apps', token, _staging, appID,
// tiny 7 writes DO parse JSON errors; see tiny#37
const { error, errors } = err.body
if (error) throw Error(error)
if (errors) throw Error(Array.isArray(errors) ? errors.at(-1) : errors)
if (errors) throw Error(Array.isArray(errors) ? errors[errors.length - 1] : errors)
else throw Error('unknown_error')
}
else {
Expand Down

0 comments on commit fc3d376

Please sign in to comment.