Skip to content
This repository was archived by the owner on Jul 15, 2024. It is now read-only.

Conversation

@fruitriin
Copy link
Contributor

@fruitriin fruitriin commented Feb 27, 2023

What

misskey.js の client が request するとき、 jsonが帰ってくることを期待せず、jsonでなければなんか適当にメッセージをrejectする

Why

misskey.js の client が request するとき、CDNなどの都合でHTMLなどが帰ってくることがある。
この場合、Promise が reject となるわけではないので、 then節へ突入する。status code は200とか204だったりする。
すると .json() したときに JSON.parse() すると例外を発生させるが、これは実行時例外となりどこにもcatchされない
Unexpected token "<" って出てるヤツがこれ

requestの中で発生しているため使う側でtry catch してもでてくるのでなんかしら対処は必要な認識

Additional info (optional)

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant