From f5ced001eb202054bcde8043359131c1b1742fb6 Mon Sep 17 00:00:00 2001 From: DIYgod Date: Sun, 31 Mar 2024 03:17:53 +0800 Subject: [PATCH] test: errors --- lib/errors/index.test.ts | 2 +- lib/errors/index.tsx | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/lib/errors/index.test.ts b/lib/errors/index.test.ts index a89a84af6..f76af6219 100644 --- a/lib/errors/index.test.ts +++ b/lib/errors/index.test.ts @@ -22,7 +22,7 @@ describe('httperror', () => { it(`httperror`, async () => { const response = await request.get('/test/httperror'); expect(response.status).toBe(503); - expect(response.text).toMatch('Response code 404 (Not Found): target website might be blocking our access, you can host your own RSSHub instance for a better usability.'); + expect(response.text).toMatch('404 Not Found: target website might be blocking our access, you can host your own RSSHub instance for a better usability.'); }, 20000); }); diff --git a/lib/errors/index.tsx b/lib/errors/index.tsx index f2ff4bde7..913bd3b82 100644 --- a/lib/errors/index.tsx +++ b/lib/errors/index.tsx @@ -39,7 +39,7 @@ export const errorHandler: ErrorHandler = (error, ctx) => { } let message = ''; - if (error.name && (error.name === 'HTTPError' || error.name === 'RequestError')) { + if (error.name && (error.name === 'HTTPError' || error.name === 'RequestError' || error.name === 'FetchError')) { ctx.status(503); message = `${error.message}: target website might be blocking our access, you can host your own RSSHub instance for a better usability.`; } else if (error instanceof RequestInProgressError) {