mirror of
https://git.mirrors.martin98.com/https://github.com/SigNoz/signoz
synced 2025-08-15 00:55:54 +08:00
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:
parent
03dccb0101
commit
27e412d1ee
@ -33,9 +33,11 @@ export async function GetMetricQueryRange(
|
||||
);
|
||||
|
||||
if (response.statusCode >= 400) {
|
||||
throw new Error(
|
||||
`API responded with ${response.statusCode} - ${response.error} status: ${response.message}, errors: ${response?.body}`,
|
||||
);
|
||||
let error = `API responded with ${response.statusCode} - ${response.error} status: ${response.message}`;
|
||||
if (response.body && !isEmpty(response.body)) {
|
||||
error = `${error}, errors: ${response.body}`;
|
||||
}
|
||||
throw new Error(error);
|
||||
}
|
||||
|
||||
if (response.payload?.data?.result) {
|
||||
|
Loading…
x
Reference in New Issue
Block a user