Skip to content
Permalink
Browse files

feat: add str to error message

  • Loading branch information...
mikeal committed Feb 12, 2019
1 parent 70525ec commit 3169f9faae6caa1255b89f25588236eb4e3965da
Showing with 8 additions and 1 deletion.
  1. +8 −1 index.js
@@ -100,7 +100,14 @@ const bent = (...args) => {
if (encoding === 'buffer') {
resolve(buff)
} else if (encoding === 'json') {
resolve(JSON.parse(buff.toString()))
let ret
try {
ret = JSON.parse(buff.toString())
resolve(ret)
} catch (e) {
e.message += `str"${buff.toString()}"`
reject(e)
}
} else if (encoding === 'string') {
resolve(buff.toString())
}

0 comments on commit 3169f9f

Please sign in to comment.
You can’t perform that action at this time.