Skip to content

Commit

Permalink
chore: improve error logging when polling queries (#140)
Browse files Browse the repository at this point in the history
  • Loading branch information
dietmar-91 authored Sep 12, 2024
1 parent 17badda commit 026e77d
Showing 1 changed file with 4 additions and 6 deletions.
10 changes: 4 additions & 6 deletions plugins/dql-backend/src/service/dynatraceApi.ts
Original file line number Diff line number Diff line change
Expand Up @@ -94,12 +94,10 @@ const pollQuery = async <T>(
},
});
if (queryPollRes.status !== 200) {
logger.error(
`Failed to poll query results for request token ${requestToken}`,
);
throw new Error(
`Failed to poll query results for request token ${requestToken}`,
);
const queryPollResBody = await queryPollRes.text();
const message = `Error: Failed to poll query results for request token ${requestToken} Status: ${queryPollRes.status} ${queryPollRes.statusText} Body: ${queryPollResBody}`;
logger.error(message);
throw new Error(message);
}
return await queryPollRes.json();
};
Expand Down

0 comments on commit 026e77d

Please sign in to comment.