问题描述
所以我试图在Visual Studio代码终端中的Firebase模拟器中本地记录对象和错误。
try {
// send request
} catch (error) {
logger.log('----');
logger.error(error);
}
问题是消息不可读,因为\n
看起来像整个消息都是一个字符串,因此不被尊重。
> {"severity":"ERROR","message":"Error: Request Failed with status code 405\n at createError (/Users/jankalthofer/Documents/Git/type-mvp/functions/node_modules/axios/lib/core/createError.js:16:15)\n at settle (/Users/jankalthofer/Documents/Git/type-mvp/functions/node_modules/axios/lib/core/settle.js:17:12)\n at IncomingMessage.handleStreamEnd (/Users/jankalthofer/Documents/Git/type-mvp/functions/node_modules/axios/lib/adapters/http.js:236:11)\n at IncomingMessage.emit (events.js:327:22)\n at endReadableNT (_stream_readable.js:1225:12)\n at processticksAndRejections (internal/process/task_queues.js:84:21) {\n config: {\n url: 'https://demo-cloud:[email protected]/',\n method: 'post',\n data: '{\"name\":\"test\",\"width\":1080,\"height\":1920}',\n headers: {\n Accept: 'application/json,text/plain,*/*',\n 'Content-Type': 'application/json;charset=utf-8',\n 'User-Agent': 'axios/0.19 ..
Here is an image of how the output looks in my terminal.
还有另一种记录对象的方式,以便它们正确地(json)格式化吗?
谢谢!
解决方法
暂无找到可以解决该程序问题的有效方法,小编努力寻找整理中!
如果你已经找到好的解决方法,欢迎将解决方案带上本链接一起发送给小编。
小编邮箱:dio#foxmail.com (将#修改为@)