Skip to content

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

Merged
merged 7 commits into from
Apr 19, 2025

Conversation

ruchidh
Copy link
Contributor

@ruchidh ruchidh commented Mar 21, 2025

Description

This PR fix a bug that causing error message in query editor as message[object object] instead of the correct error message .

There are 2 major changes in this PR:

Correctly throw error from fetch result
Properly handle error message base on current error structure

Issues Resolved

Fix message [object object] issue in ppl editor

Screenshot

Before

Screenshot 2025-03-21 at 1 45 22 PM

After

Screenshot 2025-03-21 at 3 45 00 PM

Changelog

  • fix: Correctly show error message in DQL and PPL query editor

Check List

  • All tests pass
    • yarn test:jest
    • yarn test:jest_integration
  • New functionality includes testing.
  • New functionality has been documented.
  • Update CHANGELOG.md
  • Commits are signed per the DCO using --signoff

Copy link
Contributor

❌ Empty Changelog Section

The 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.

@ruchidh ruchidh changed the title Fix error handling in discover query editor Fix: Correctly show error message in DQL and PPL query editor Mar 21, 2025
Copy link

codecov bot commented Mar 22, 2025

Codecov Report

All modified and coverable lines are covered by tests ✅

Project coverage is 61.85%. Comparing base (c694ed6) to head (237038f).
Report is 1 commits behind head on main.

Additional details and impacted files
@@            Coverage Diff             @@
##             main    #9589      +/-   ##
==========================================
- Coverage   61.85%   61.85%   -0.01%     
==========================================
  Files        3802     3802              
  Lines       91982    91992      +10     
  Branches    14627    14632       +5     
==========================================
+ Hits        56898    56904       +6     
  Misses      31407    31407              
- Partials     3677     3681       +4     
Flag Coverage Δ
Linux_1 28.90% <0.00%> (-0.01%) ⬇️
Linux_2 56.33% <ø> (ø)
Linux_3 39.37% <100.00%> (-0.01%) ⬇️
Linux_4 28.85% <72.72%> (+<0.01%) ⬆️
Windows_1 28.92% <0.00%> (-0.01%) ⬇️
Windows_2 56.28% <ø> (ø)
Windows_3 39.38% <100.00%> (-0.01%) ⬇️
Windows_4 28.84% <72.72%> (+<0.01%) ⬆️

Flags with carried forward coverage won't be shown. Click here to find out more.

☔ View full report in Codecov by Sentry.
📢 Have feedback on the report? Share it here.

🚀 New features to boost your workflow:
  • ❄️ Test Analytics: Detect flaky tests, report on failures, and find test suite problems.
  • 📦 JS Bundle Analysis: Save yourself from yourself by tracking and limiting bundle sizes in JS merges.

LDrago27
LDrago27 previously approved these changes Mar 22, 2025
Copy link
Collaborator

@angle943 angle943 left a 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?

@Maosaic
Copy link
Collaborator

Maosaic commented Mar 31, 2025

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.

@ruchidh ruchidh requested a review from wanglam as a code owner April 2, 2025 00:39
@ruchidh ruchidh force-pushed the fix-query-error-handling branch from f888102 to 4524c06 Compare April 18, 2025 19:27
opensearch-changeset-bot bot added a commit to ruchidh/OpenSearch-Dashboards that referenced this pull request Apr 18, 2025
@ruchidh ruchidh force-pushed the fix-query-error-handling branch from 32f340f to 09e0849 Compare April 18, 2025 21:03
@ruchidh
Copy link
Contributor Author

ruchidh commented Apr 18, 2025

could we add some unit tests?

added

@ruchidh
Copy link
Contributor Author

ruchidh commented Apr 18, 2025

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.

done

opensearch-changeset-bot bot added a commit to ruchidh/OpenSearch-Dashboards that referenced this pull request Apr 18, 2025
LDrago27
LDrago27 previously approved these changes Apr 18, 2025
@ananzh
Copy link
Member

ananzh commented Apr 18, 2025

Test failed

Summary of all failing tests
 FAIL  src/core/server/rendering/rendering_service.test.ts
  ● RenderingService › isUrlValid() › checks valid SVG URL

    expect(received).toEqual(expected) // deep equality

    Expected: true
    Received: false

      214 |         'config'
      215 |       );
    > 216 |       expect(result).toEqual(true);
          |                      ^
      217 |     });
      218 |
      219 |     it('checks valid PNG URL', async () => {

      at Object.<anonymous> (src/core/server/rendering/rendering_service.test.ts:216:22)

  ● RenderingService › isUrlValid() › checks valid PNG URL

    expect(received).toEqual(expected) // deep equality

    Expected: true
    Received: false

      222 |         'config'
      223 |       );
    > 224 |       expect(result).toEqual(true);
          |                      ^
      225 |     });
      226 |
      227 |     it('checks invalid URL that does not contain svg, png or gif', async () => {

      at Object.<anonymous> (src/core/server/rendering/rendering_service.test.ts:224:22)


Test Suites: 1 failed, 2 skipped, 478 passed, 479 of 481 total
Tests:       2 failed, 35 skipped, 8 todo, 4679 passed, 4724 total
Snapshots:   1514 passed, 1514 total
Time:        308.66 s
Ran all test suites.
error Command failed with exit code 1.
info Visit https://yarnpkg.com/en/docs/cli/run for documentation about this command.
Error: Process completed with exit code 1.

@LDrago27 LDrago27 force-pushed the fix-query-error-handling branch from 9106ec1 to 237038f Compare April 18, 2025 23:10
@LDrago27 LDrago27 merged commit 1aa82f5 into opensearch-project:main Apr 19, 2025
75 of 76 checks passed
ruchidh added a commit to ruchidh/OpenSearch-Dashboards that referenced this pull request Apr 29, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

6 participants