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() }; };