diff --git a/src/_read.cjs b/src/_read.cjs index 27ad91b..70690a5 100644 --- a/src/_read.cjs +++ b/src/_read.cjs @@ -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 { diff --git a/src/_write.cjs b/src/_write.cjs index 2e1e49f..2b44c60 100644 --- a/src/_write.cjs +++ b/src/_write.cjs @@ -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 {