From 3bda9cb9ba3363757047fe31ea8ccbf79b769628 Mon Sep 17 00:00:00 2001 From: Dave Falke Date: Mon, 25 Sep 2023 11:12:11 -0400 Subject: [PATCH] Remove initial new line from error message (#520) (cherry picked from commit 81b3dae3a2170c67e58d936457e4da66160475a1) --- packages/libs/http-utils/src/FetchClient.ts | 11 +++++++---- 1 file changed, 7 insertions(+), 4 deletions(-) diff --git a/packages/libs/http-utils/src/FetchClient.ts b/packages/libs/http-utils/src/FetchClient.ts index 6e0ff116c8..5e4b455128 100644 --- a/packages/libs/http-utils/src/FetchClient.ts +++ b/packages/libs/http-utils/src/FetchClient.ts @@ -107,11 +107,14 @@ export abstract class FetchClient { const { status, statusText } = response; const { headers, method, url } = request; const traceid = headers.get('traceid'); - const fetchError = new FetchClientError(` - ${status} ${statusText}: ${method.toUpperCase()} ${url} - ${traceid != null ? 'Traceid: ' + traceid : ''} + const fetchError = new FetchClientError( + [ + `${status} ${statusText}: ${method.toUpperCase()} ${url}`, + traceid != null ? 'Traceid: ' + traceid + '\n' : '', + await response.text(), + ].join('\n') + ); - ${await response.text()}`); this.onNonSuccessResponse?.(fetchError); throw fetchError; }