-
Notifications
You must be signed in to change notification settings - Fork 992
Fix: Correctly show error message in DQL and PPL query editor #9589
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
base: main
Are you sure you want to change the base?
Fix: Correctly show error message in DQL and PPL query editor #9589
Conversation
Signed-off-by: Joey Liu <[email protected]>
Signed-off-by: Ruchi Sharma <[email protected]>
❌ Empty Changelog SectionThe Changelog section in your PR description is empty. Please add a valid changelog entry or entries. If you did add a changelog entry, check to make sure that it was not accidentally included inside the comment block in the Changelog section. |
Signed-off-by: Ruchi Sharma <[email protected]>
Signed-off-by: Ruchi Sharma <[email protected]>
❌ Empty Changelog SectionThe Changelog section in your PR description is empty. Please add a valid changelog entry or entries. If you did add a changelog entry, check to make sure that it was not accidentally included inside the comment block in the Changelog section. |
Signed-off-by: Ruchi Sharma <[email protected]>
❌ Empty Changelog SectionThe Changelog section in your PR description is empty. Please add a valid changelog entry or entries. If you did add a changelog entry, check to make sure that it was not accidentally included inside the comment block in the Changelog section. |
❌ Changelog Entry Missing HyphenChangelog entries must begin with a hyphen (-). |
2 similar comments
❌ Changelog Entry Missing HyphenChangelog entries must begin with a hyphen (-). |
❌ Changelog Entry Missing HyphenChangelog entries must begin with a hyphen (-). |
Codecov ReportAttention: Patch coverage is
Additional details and impacted files@@ Coverage Diff @@
## main #9589 +/- ##
========================================
Coverage 61.78% 61.79%
========================================
Files 3807 3797 -10
Lines 91933 91777 -156
Branches 14597 14570 -27
========================================
- Hits 56802 56713 -89
+ Misses 31452 31440 -12
+ Partials 3679 3624 -55
Flags with carried forward coverage won't be shown. Click here to find out more. ☔ View full report in Codecov by Sentry. 🚀 New features to boost your workflow:
|
@@ -329,6 +350,19 @@ export const useSearch = (services: DiscoverViewServices) => { | |||
} | |||
} | |||
|
|||
// Currently error message is sent as encoded JSON string, which requires extra parsing | |||
// TODO: Confirm error contract |
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.
nit: You can create an issue to track the "Todo: Confirm error contract" and mention it here
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.
understood , thank you
Signed-off-by: Ruchi Sharma <[email protected]>
Signed-off-by: Ruchi Sharma <[email protected]>
let errorMessage = response.data.body?.message ?? response.data.body ?? response.data; | ||
|
||
// Check if errorMessage is an object and handle Error objects | ||
if (typeof errorMessage === 'object') { | ||
if (errorMessage instanceof Error) { | ||
// If errorMessage is an instance of Error, extract its message | ||
errorMessage = errorMessage.message; | ||
} else if (errorMessage.message) { | ||
// If errorMessage has a message property, extract that message | ||
errorMessage = JSON.stringify(errorMessage.message); | ||
} else { | ||
// If errorMessage is a plain object, stringify it | ||
errorMessage = JSON.stringify(errorMessage); | ||
} | ||
} |
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.
not for this PR, but looks like there's some more digging we can do to figure out how we can have some sort of response interface here. Right now it looks we're in the wild west 🤠
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.
could we add some unit tests?
can you remove the code changes included in #9586 ? I have made some change on that PR, to avoid conflicts and keep thing clean, I think we should remove the duplicate change here. |
Signed-off-by: Ruchi Sharma <[email protected]>
Description
This PR fix a bug that causing error message in query editor to show Cannot read properties of undefined (reading 'hasOwnProperty') and message[object object] instead of the correct error message and also added a toaster at bottom for detailed error message.
There are 3 major changes in this PR:
Correctly throw error from fetch result
Properly handle error message base on current error structure
Add toaster for query editor dispaly error
Reference from pr by @Maosaic - #9586
Issues Resolved
Fix a issue that cause error message in query editor to show Cannot read properties of undefined (reading 'hasOwnProperty')
Fix message [object object] issue
Screenshot
Before

After

Changelog
Check List
yarn test:jest
yarn test:jest_integration