Skip to content

Commit 89a7a32

Browse files
committed
🐛 Faild to proceed when code blocks are not found
1 parent 5c89a67 commit 89a7a32

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)