Skip to content
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

Throw error if it exists for dashboard variables #117

Merged
merged 2 commits into from
Nov 30, 2021

Conversation

andresmgot
Copy link
Contributor

Fixes #101

Screenshot from 2021-11-26 13-21-06

In the future, we should replace this code and use a custom variable editor.

@andresmgot andresmgot requested review from ryantxu, a team, iwysiu and vickyyyyyyy and removed request for a team November 26, 2021 12:33
Copy link
Member

@vickyyyyyyy vickyyyyyyy left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM - would we be able to add a test for this?

@@ -291,6 +291,9 @@ export class DataSource extends DataSourceWithBackend<TimestreamQuery, Timestrea
range,
} as unknown) as DataQueryRequest).pipe(
map((res) => {
if (res.error) {
throw new Error(res.error.message);
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

would it be possible for res.error to not have a message? If so, should we handle that case with res.error?.message?

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

oops, I meant to check if there is a message, not that we want to throw an error with no message 😄

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

by definition yes, message is optional, but in practice don't think so

@andresmgot
Copy link
Contributor Author

LGTM - would we be able to add a test for this?

I wouldn't worry that much about it in this case. We should refactor this component and use a proper QueryEditor here so this code won't be used.

@andresmgot andresmgot merged commit b4c29a8 into main Nov 30, 2021
@andresmgot andresmgot deleted the templateVariableError branch February 23, 2022 09:55
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Errors in template variable queries are not shown in the dashboard
2 participants