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

♻️🎨 Improves error handling in the api-server #5866

Merged
merged 31 commits into from
May 27, 2024

Conversation

pcrespov
Copy link
Member

@pcrespov pcrespov commented May 23, 2024

What do these changes do?

In this PR we do an initial refactoring by reorganizing the code base for errors in simcore_service_api_server. In this round we place all error logic under simcore_service_api_server.models.errors before doing changes in the logic

  • ♻️ error handlers under simcore_service_api_server.exceptions
    • includes both exception handlers and exception classes ( also denoted error )
  • 🎨 Common base class for all exceptions in this service ApiServerBaseError(OsparcErrorMixin, Exception)
  • 🎨 Improved messages when unexpected exceptions ( closes API: Internal Server Error osparc-issues#491 )
    • human readable
    • OEC identifier
    • logs exception in the backend for diagnostics

Related issue/s

How to test

  • Driving test for exception handlers in services/api-server/tests/unit/test_exceptions.py

Dev-ops checklist

@pcrespov pcrespov self-assigned this May 23, 2024
@pcrespov pcrespov force-pushed the mai/error-handling-api-server branch from 9a1ec2a to ab929b9 Compare May 23, 2024 15:03
Copy link

codecov bot commented May 23, 2024

Codecov Report

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

Project coverage is 74.5%. Comparing base (cafbf96) to head (b52652e).
Report is 224 commits behind head on master.

Current head b52652e differs from pull request most recent head ae8e58a

Please upload reports for the commit ae8e58a to get more accurate results.

Additional details and impacted files

Impacted file tree graph

@@            Coverage Diff            @@
##           master   #5866      +/-   ##
=========================================
- Coverage    84.5%   74.5%   -10.1%     
=========================================
  Files          10     301     +291     
  Lines         214   14514   +14300     
  Branches       25     205     +180     
=========================================
+ Hits          181   10822   +10641     
- Misses         23    3640    +3617     
- Partials       10      52      +42     
Flag Coverage Δ
integrationtests 71.3% <ø> (?)
unittests 89.2% <88.3%> (+4.6%) ⬆️

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

Files Coverage Δ
...src/simcore_service_api_server/api/routes/files.py 78.3% <100.0%> (ø)
...c/simcore_service_api_server/api/routes/solvers.py 65.0% <100.0%> (ø)
...core_service_api_server/api/routes/solvers_jobs.py 100.0% <100.0%> (ø)
...src/simcore_service_api_server/api/routes/users.py 100.0% <100.0%> (ø)
...c/simcore_service_api_server/api/routes/wallets.py 100.0% <100.0%> (ø)
...src/simcore_service_api_server/core/application.py 96.8% <100.0%> (ø)
.../simcore_service_api_server/exceptions/__init__.py 100.0% <100.0%> (ø)
...src/simcore_service_api_server/exceptions/_base.py 100.0% <100.0%> (ø)
...ore_service_api_server/exceptions/custom_errors.py 100.0% <100.0%> (ø)
...service_api_server/exceptions/handlers/__init__.py 100.0% <100.0%> (ø)
... and 16 more

... and 282 files with indirect coverage changes

@pcrespov pcrespov force-pushed the mai/error-handling-api-server branch from 9905e7d to f281677 Compare May 23, 2024 19:34
@pcrespov pcrespov added the a:apiserver api-server service label May 24, 2024
@pcrespov pcrespov added this to the Leeroy Jenkins milestone May 24, 2024
@pcrespov pcrespov marked this pull request as ready for review May 24, 2024 14:52
@pcrespov pcrespov requested a review from bisgaard-itis as a code owner May 24, 2024 14:52
@pcrespov pcrespov force-pushed the mai/error-handling-api-server branch from 642fda5 to 14b8dd1 Compare May 24, 2024 14:52
@pcrespov pcrespov requested a review from bisgaard-itis as a code owner May 24, 2024 14:52
@pcrespov pcrespov changed the title WIP: 🎨 Mai/error handling api server ♻️🎨 Improves error handling in the api-server May 24, 2024
@pcrespov pcrespov enabled auto-merge (squash) May 24, 2024 14:53
Copy link
Member

@sanderegg sanderegg left a comment

Choose a reason for hiding this comment

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

nice and clean! thanks

Copy link
Collaborator

@matusdrobuliak66 matusdrobuliak66 left a comment

Choose a reason for hiding this comment

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

Thanks!

@pcrespov pcrespov force-pushed the mai/error-handling-api-server branch from 5b824ad to ba892ea Compare May 27, 2024 07:42
Copy link
Contributor

@bisgaard-itis bisgaard-itis left a comment

Choose a reason for hiding this comment

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

Very cool. Thanks a lot 🚀

@pcrespov pcrespov force-pushed the mai/error-handling-api-server branch from b52652e to 425db35 Compare May 27, 2024 08:15
@pcrespov pcrespov requested a review from GitHK May 27, 2024 08:15
Copy link

Quality Gate Passed Quality Gate passed

Issues
0 New issues
0 Accepted issues

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

See analysis details on SonarCloud

Copy link
Contributor

@GitHK GitHK left a comment

Choose a reason for hiding this comment

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

all good

@pcrespov pcrespov merged commit 52753fd into ITISFoundation:master May 27, 2024
50 of 51 checks passed
@pcrespov pcrespov deleted the mai/error-handling-api-server branch May 27, 2024 16:28
@matusdrobuliak66 matusdrobuliak66 mentioned this pull request Jun 12, 2024
30 tasks
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
a:apiserver api-server service
Projects
None yet
Development

Successfully merging this pull request may close these issues.

API: improve error handling API: Internal Server Error
5 participants