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

Handle Server Side Errors #8562

Merged
merged 1 commit into from
Oct 14, 2024
Merged

Conversation

LDrago27
Copy link
Collaborator

Description

Handles internal Server Error that were being thrown.

Issues Resolved

Screenshot

Testing the changes

Changelog

  • skip

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

@github-actions github-actions bot added all-star-contributor Skip-Changelog PRs that are too trivial to warrant a changelog or release notes entry labels Oct 11, 2024
Copy link

codecov bot commented Oct 11, 2024

Codecov Report

Attention: Patch coverage is 40.00000% with 3 lines in your changes missing coverage. Please review.

Project coverage is 60.96%. Comparing base (9eae148) to head (d75b02e).
Report is 23 commits behind head on main.

Files with missing lines Patch % Lines
src/plugins/data/server/dql_telemetry/route.ts 0.00% 2 Missing ⚠️
...ver/lib/timeseries_visualization_client_wrapper.ts 66.66% 1 Missing ⚠️
Additional details and impacted files
@@            Coverage Diff             @@
##             main    #8562      +/-   ##
==========================================
+ Coverage   60.93%   60.96%   +0.02%     
==========================================
  Files        3769     3776       +7     
  Lines       89508    89655     +147     
  Branches    14013    14048      +35     
==========================================
+ Hits        54541    54654     +113     
- Misses      31557    31590      +33     
- Partials     3410     3411       +1     
Flag Coverage Δ
Linux_1 29.12% <40.00%> (+0.11%) ⬆️
Linux_2 56.27% <0.00%> (+0.02%) ⬆️
Linux_3 37.78% <0.00%> (+0.03%) ⬆️
Linux_4 29.95% <0.00%> (+0.03%) ⬆️
Windows_1 29.14% <40.00%> (+0.11%) ⬆️
Windows_2 56.23% <0.00%> (+0.02%) ⬆️
Windows_3 37.79% <0.00%> (+0.03%) ⬆️
Windows_4 29.95% <0.00%> (+0.03%) ⬆️

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.

@LDrago27 LDrago27 force-pushed the secFix branch 4 times, most recently from d1fceaa to 4458935 Compare October 11, 2024 23:14
Signed-off-by: Suchit Sahoo <[email protected]>
await internalRepository.incrementCounter('dql-telemetry', 'dql-telemetry', counterName);
} catch (error) {
logger.warn(`Unable to increment counter: ${error}`);
return response.customError({
statusCode: error.status,
statusCode: error.status || 403,
Copy link
Collaborator

Choose a reason for hiding this comment

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

why the default status code be 403?

Copy link
Member

Choose a reason for hiding this comment

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

+1

Copy link
Collaborator Author

Choose a reason for hiding this comment

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

The additional error scenario that we are trying to capture are failures during the initialization of const internalRepository = savedObjects.createScopedRepository(request);. This failures occur if the users permissions are lacking. Hence added the default 403 since for other errors they already have an associated status code.

@LDrago27 LDrago27 merged commit 2be8d04 into opensearch-project:main Oct 14, 2024
73 of 74 checks passed
opensearch-trigger-bot bot pushed a commit that referenced this pull request Oct 14, 2024
Signed-off-by: Suchit Sahoo <[email protected]>
(cherry picked from commit 2be8d04)
Signed-off-by: github-actions[bot] <github-actions[bot]@users.noreply.github.com>
LDrago27 pushed a commit that referenced this pull request Oct 15, 2024
sejli pushed a commit to sejli/OpenSearch-Dashboards that referenced this pull request Oct 21, 2024
Qxisylolo pushed a commit to Qxisylolo/OpenSearch-Dashboards that referenced this pull request Oct 30, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
all-star-contributor backport 2.x discover-next Skip-Changelog PRs that are too trivial to warrant a changelog or release notes entry v2.18.0
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants