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

🐛 HTTPException -> JSONResponse: fix exception handler in api-server #5385

Conversation

bisgaard-itis
Copy link
Contributor

@bisgaard-itis bisgaard-itis commented Feb 28, 2024

What do these changes do?

  • I recently introduced a more comprehensive exception handling in the api-server. However I learned that Starlette catches my HTTPExceptions and returns them to the client with status code 500 because I should be using JSONResponse instead.
  • This fixes this issue.

Related issue/s

How to test

Dev Checklist

DevOps Checklist

@bisgaard-itis bisgaard-itis self-assigned this Feb 28, 2024
@bisgaard-itis bisgaard-itis added bug buggy, it does not work as expected a:apiserver api-server service labels Feb 28, 2024
@bisgaard-itis bisgaard-itis added this to the Schoggilebe milestone Feb 28, 2024
@bisgaard-itis bisgaard-itis marked this pull request as ready for review February 28, 2024 06:02
Copy link

codecov bot commented Feb 28, 2024

Codecov Report

Attention: Patch coverage is 66.66667% with 1 lines in your changes are missing coverage. Please review.

Project coverage is 65.7%. Comparing base (194830a) to head (7a5b356).

Additional details and impacted files

Impacted file tree graph

@@            Coverage Diff            @@
##           master   #5385      +/-   ##
=========================================
- Coverage    87.5%   65.7%   -21.8%     
=========================================
  Files        1322     613     -709     
  Lines       54221   29878   -24343     
  Branches     1174     203     -971     
=========================================
- Hits        47465   19647   -27818     
- Misses       6507   10180    +3673     
+ Partials      249      51     -198     
Flag Coverage Δ
integrationtests 63.9% <ø> (-1.3%) ⬇️
unittests 84.5% <66.6%> (-0.9%) ⬇️

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

Files Coverage Δ
...ervice_api_server/api/errors/httpx_client_error.py 43.7% <66.6%> (+3.7%) ⬆️

... and 1055 files with indirect coverage changes

@bisgaard-itis bisgaard-itis enabled auto-merge (squash) February 28, 2024 06:22
Copy link

Quality Gate Passed Quality Gate passed

Issues
0 New issues

Measures
0 Security Hotspots
No data about Coverage
0.0% Duplication on New Code

See analysis details on SonarCloud

@bisgaard-itis bisgaard-itis merged commit 524b781 into ITISFoundation:master Feb 28, 2024
55 checks passed
@bisgaard-itis bisgaard-itis deleted the 5384-fix-exception-handler-in-api-server branch February 28, 2024 08:04
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
a:apiserver api-server service bug buggy, it does not work as expected
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Fix exception handler in api server
4 participants