UNPKG
koa-body
Version:
latest (8.0.0)
8.0.0
7.0.1
7.0.0
6.0.1
6.0.0
5.0.0
4.2.0
4.1.3
4.1.2
4.1.1
4.1.0
4.0.8
4.0.7
4.0.6
4.0.5
4.0.4
4.0.3
4.0.2
4.0.1
4.0.0
3.0.0
2.6.0
2.5.0
2.4.0
2.3.0
2.1.0
2.0.1
2.0.0
1.7.0
1.6.0
1.5.0
1.4.0
1.3.0
1.2.1
1.2.0
1.1.0
1.0.1
1.0.0
0.4.0
0.3.0
0.2.0
0.1.0
0.0.4
0.0.3
0.0.2
0.0.1
A Koa body parser middleware. Supports multipart, urlencoded and JSON request bodies.
koajs/koa-body
koa-body
/
dist
/
esm
/
utils
/
throwable-to-error.js
10 lines
•
303 B
JavaScript
View Raw
1
2
3
4
5
6
7
8
9
10
export
default
function
throwableToError
(
e
) {
if
(e
instanceof
Error
) {
return
e; }
const
error =
new
Error
(
typeof
e ===
'object'
?
JSON
.
stringify
(e) :
`
${e}
`
); error.
name
=
typeof
e; error.
stack
=
undefined
;
return
error; }
//# sourceMappingURL=throwable-to-error.js.map