refactor: removed the error body (#4850)

* refactor: removed the error body

* refactor: check for error response body condition

* refactor: empty object check
This commit is contained in:
Rajat Dabade 2024-04-10 15:19:01 +05:30 committed by GitHub
parent 03dccb0101
commit 27e412d1ee
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194

View File

@ -33,9 +33,11 @@ export async function GetMetricQueryRange(
); );
if (response.statusCode >= 400) { if (response.statusCode >= 400) {
throw new Error( let error = `API responded with ${response.statusCode} - ${response.error} status: ${response.message}`;
`API responded with ${response.statusCode} - ${response.error} status: ${response.message}, errors: ${response?.body}`, if (response.body && !isEmpty(response.body)) {
); error = `${error}, errors: ${response.body}`;
}
throw new Error(error);
} }
if (response.payload?.data?.result) { if (response.payload?.data?.result) {