From 89a7a32aa51584e9ed7a0afb89c5a64eefdc8c3b Mon Sep 17 00:00:00 2001 From: takker99 <37929109+takker99@users.noreply.github.com> Date: Sun, 3 Sep 2023 10:38:01 +0900 Subject: [PATCH] :bug: Faild to proceed when code blocks are not found --- rest/getCodeBlock.ts | 8 +++++++- 1 file changed, 7 insertions(+), 1 deletion(-) diff --git a/rest/getCodeBlock.ts b/rest/getCodeBlock.ts index b0e8261..f4cdc9a 100644 --- a/rest/getCodeBlock.ts +++ b/rest/getCodeBlock.ts @@ -27,7 +27,13 @@ const getCodeBlock_toRequest: GetCodeBlock["toRequest"] = ( const getCodeBlock_fromResponse: GetCodeBlock["fromResponse"] = async (res) => { if (!res.ok) { - return makeError(res); + return res.status === 404 && + res.headers.get("Content-Type")?.includes?.("text/plain") + ? { + ok: false, + value: { name: "NotFoundError", message: "Code block is not found" }, + } + : makeError(res); } return { ok: true, value: await res.text() }; };