-
Notifications
You must be signed in to change notification settings - Fork 15
Improve health check by returning errors properly #327
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Conversation
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Left a comment bellow.
@@ -81,23 +81,19 @@ export class BigQueryDatasource extends DataSourceWithBackend<BigQueryQueryNG, B | |||
async testDatasource() { | |||
const health = await this.callHealthCheck(); | |||
if (health.status?.toLowerCase() === 'error') { | |||
return { status: 'error', message: health.message, details: health.details }; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Aren't we loosing details: health.details
here? Can't we do
Promise.reject({
status: 'error',
message: health.message,
details: health.details,
err: new Error(health.message)
})
} | ||
|
||
const client = await getApiClient(this.id); | ||
try { | ||
await client.getProjects(); | ||
} catch (err: any) { | ||
return { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Same as above
Thanks @ivanahuckova, I changed the code so now the details are provided as well. This is the way how we do in grafana/grafana https://github.com/grafana/grafana/blob/main/packages/grafana-runtime/src/utils/DataSourceWithBackend.ts#L385 |
No description provided.