From 6dc50b9722d61f840144265695bc73f82b5162af Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?T=C3=B3th=20D=C3=A1niel?= Date: Thu, 10 Aug 2023 12:12:20 +0200 Subject: [PATCH] Fix error handle (#23) --- src/error-handler.ts | 9 +++++++-- 1 file changed, 7 insertions(+), 2 deletions(-) diff --git a/src/error-handler.ts b/src/error-handler.ts index dbbfcc6..a287bd2 100644 --- a/src/error-handler.ts +++ b/src/error-handler.ts @@ -3,8 +3,13 @@ import * as vscode from 'vscode'; export async function handleError(errorTitle: string, error: any): Promise { let errorDetails = ''; if (error?.response?.body) { - for (const [p, val] of Object.entries(error?.response?.body)) { - errorDetails += `${p}: ${val}\n`; + + if (typeof error?.response?.body == "string") { + errorDetails = error?.response?.body; + } else { + for (const [p, val] of Object.entries(error?.response?.body)) { + errorDetails += `${p}: ${val}\n`; + } } }