Skip to content

Commit 8c723c0

Browse files
authored
Merge pull request #139 from takker99/fix-codeblock-error
🐛 Faild to proceed when code blocks are not found
2 parents 5c89a67 + 89a7a32 commit 8c723c0

File tree

1 file changed

+7
-1
lines changed

1 file changed

+7
-1
lines changed

rest/getCodeBlock.ts

+7-1
Original file line numberDiff line numberDiff line change
@@ -27,7 +27,13 @@ const getCodeBlock_toRequest: GetCodeBlock["toRequest"] = (
2727

2828
const getCodeBlock_fromResponse: GetCodeBlock["fromResponse"] = async (res) => {
2929
if (!res.ok) {
30-
return makeError<NotFoundError | NotLoggedInError | NotMemberError>(res);
30+
return res.status === 404 &&
31+
res.headers.get("Content-Type")?.includes?.("text/plain")
32+
? {
33+
ok: false,
34+
value: { name: "NotFoundError", message: "Code block is not found" },
35+
}
36+
: makeError<NotFoundError | NotLoggedInError | NotMemberError>(res);
3137
}
3238
return { ok: true, value: await res.text() };
3339
};

0 commit comments

Comments
 (0)