你的对象e
是一个错误对象。当您尝试字符串化您进入{}
chrome 和 node.js 时。Safari 显示更多信息。
let e = new Error("hello")
console.log(typeof e)
console.log(JSON.stringify(e))
您可以使用以下方法测试错误:
let e = new Error("Some error happened")
if (e instanceof Error) {
console.log("Error:", e.message)
}
本文收集自互联网,转载请注明来源。
如有侵权,请联系[email protected] 删除。
我来说两句