From 1e28bfecd829baaaf63ea5319be46e5f2604b814 Mon Sep 17 00:00:00 2001 From: Max Rozen <3822106+rozenmd@users.noreply.github.com> Date: Mon, 5 Feb 2024 13:47:00 +0000 Subject: [PATCH] address PR feedback --- packages/wrangler/src/d1/execute.tsx | 6 ++---- 1 file changed, 2 insertions(+), 4 deletions(-) diff --git a/packages/wrangler/src/d1/execute.tsx b/packages/wrangler/src/d1/execute.tsx index fb3f4b1fd8ce..f31b6dc5d6fd 100644 --- a/packages/wrangler/src/d1/execute.tsx +++ b/packages/wrangler/src/d1/execute.tsx @@ -151,12 +151,10 @@ export const Handler = async (args: HandlerOptions): Promise => { logger.log(JSON.stringify(response, null, 2)); } } catch (error) { - if (json) { + if (json && error instanceof Error) { logger.loggerLevel = existingLogLevel; const messageToDisplay = - (error as Error).name === "APIError" - ? error - : { text: (error as Error).message }; + error.name === "APIError" ? error : { text: error.message }; throw new JsonFriendlyFatalError( JSON.stringify({ error: messageToDisplay }, null, 2) );