From 3591b93c2d3288c49c29199eadb2b05fe210d308 Mon Sep 17 00:00:00 2001 From: Carlos Valente Date: Sun, 27 Oct 2024 10:00:15 +0100 Subject: [PATCH] refactor: handle thrown errors --- apps/client/src/common/api/utils.ts | 2 ++ 1 file changed, 2 insertions(+) diff --git a/apps/client/src/common/api/utils.ts b/apps/client/src/common/api/utils.ts index cc9f7a79b..9f2f35ce2 100644 --- a/apps/client/src/common/api/utils.ts +++ b/apps/client/src/common/api/utils.ts @@ -23,6 +23,8 @@ export function maybeAxiosError(error: unknown) { } } return `${statusText}: ${data}`; + } else if (error instanceof Error) { + return error.message; } else { if (typeof error !== 'string') { return JSON.stringify(error);