From b16fc0b0c1b80872b15d90de586bcbe6788260c3 Mon Sep 17 00:00:00 2001 From: Enrico Ros Date: Fri, 22 Sep 2023 01:38:09 -0700 Subject: [PATCH] Improve error messaging on http errors --- src/modules/trpc/trpc.serverutils.ts | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/src/modules/trpc/trpc.serverutils.ts b/src/modules/trpc/trpc.serverutils.ts index a73cbb2b1..7264a97ed 100644 --- a/src/modules/trpc/trpc.serverutils.ts +++ b/src/modules/trpc/trpc.serverutils.ts @@ -39,7 +39,9 @@ function createFetcherFromTRPC(parser: (response: Response) => code: 'BAD_REQUEST', message: error ? `[${moduleName} Issue] ${error?.error?.message || error?.error || error?.toString() || 'Unknown http error'}` - : `[Issue] ${response.statusText} (${response.status})` + (response.status === 403 ? ` - is ${url} accessible by the server?` : ''), + : `[Issue] ${moduleName} ${response.statusText} (${response.status})` + + (response.status === 403 ? ` - is ${url} accessible by the server?` : '') + + (response.status === 502 ? ` - is ${url} down?` : ''), }); } try {