koishijs / novelai-bot

Generate images by NovelAI | 基于 NovelAI 的画图机器人
https://bot.novelai.dev
MIT License
2.49k stars 204 forks source link

feat: handle `JSON.parse` error #220

Closed idranme closed 9 months ago

idranme commented 11 months ago

fix #222

MaikoTan commented 11 months ago

If you are going to catch that error, you MUST handle it rather than leave it blank in the catch block.

idranme commented 11 months ago

If you are going to catch that error, you MUST handle it rather than leave it blank in the catch block.

changed

idranme commented 10 months ago

你是不是应该处理它,而不是单纯 warn 一下?这里的 res.data.info 是不可解析的吗?

更改了

idranme commented 10 months ago

你是不是应该处理它,而不是单纯 warn 一下?这里的 res.data.info 是不可解析的吗?

res.data.info 有两种意外的类型,一个是 undefined,另一个是 object

MaikoTan commented 10 months ago

res.data.info 有两种意外的类型,一个是 undefined,另一个是 object

Then what does JSON.parse() do, suppose that it can only be undefined or object?

idranme commented 10 months ago

Then what does JSON.parse() do, suppose that it can only be undefined or object?

throws an error