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

refactor: remove API v1 responses exception captures #4904

Conversation

jfcalvo
Copy link
Member

@jfcalvo jfcalvo commented May 29, 2024

Description

This PR remove all exception capture blocks for API v1 responses handler.

Refs #4871

Type of change

(Please delete options that are not relevant. Remember to title the PR according to the type of change)

  • Bug fix (non-breaking change which fixes an issue)
  • New feature (non-breaking change which adds functionality)
  • Breaking change (fix or feature that would cause existing functionality to not work as expected)
  • Refactor (change restructuring the codebase without changing functionality)
  • Improvement (change adding some improvement to an existing functionality)
  • Documentation update

How Has This Been Tested

(Please describe the tests that you ran to verify your changes. And ideally, reference tests)

  • Improving and passing existent tests.

Checklist

  • I added relevant documentation
  • follows the style guidelines of this project
  • I did a self-review of my code
  • I made corresponding changes to the documentation
  • My changes generate no new warnings
  • I have added tests that prove my fix is effective or that my feature works
  • I filled out the contributor form (see text above)
  • I have added relevant notes to the CHANGELOG.md file (See https://keepachangelog.com/)

@jfcalvo jfcalvo requested a review from frascuchon May 29, 2024 12:05
@@ -99,10 +100,10 @@ async def _upsert_records_suggestions(
try:
SuggestionCreateValidator(suggestion_create).validate_for(question.parsed_settings, record)
upsert_many_suggestions.append(dict(**suggestion_create.dict(), record_id=record.id))
except ValueError as ex:
except (UnprocessableEntityError, ValueError) as ex:
Copy link
Member Author

@jfcalvo jfcalvo May 29, 2024

Choose a reason for hiding this comment

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

@frascuchon once that everything is refactored I will change these kind of lines to be something like:

Suggested change
except (UnprocessableEntityError, ValueError) as ex:
except UnprocessableEntityError as ex:

Copy link
Member

Choose a reason for hiding this comment

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

Okay but the raised error shouldn't be UnprocessableEntity?

Copy link
Member Author

Choose a reason for hiding this comment

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

Base automatically changed from refactor/remove-api-v1-metadata-properties-exceptions to refactor/improve-api-v1-error-handling May 31, 2024 15:33
Copy link

codecov bot commented May 31, 2024

Codecov Report

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

Project coverage is 90.97%. Comparing base (e3aa28a) to head (3f65793).

Files Patch % Lines
...r/src/argilla_server/validators/response_values.py 85.00% 3 Missing ⚠️
...lla-server/src/argilla_server/contexts/datasets.py 93.33% 1 Missing ⚠️
Additional details and impacted files
@@                            Coverage Diff                             @@
##           refactor/improve-api-v1-error-handling    #4904      +/-   ##
==========================================================================
- Coverage                                   90.97%   90.97%   -0.01%     
==========================================================================
  Files                                         206      206              
  Lines                                       10001    10000       -1     
==========================================================================
- Hits                                         9098     9097       -1     
  Misses                                        903      903              
Flag Coverage Δ
argilla-server 90.97% <91.48%> (-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.

@jfcalvo jfcalvo merged commit b8847e9 into refactor/improve-api-v1-error-handling May 31, 2024
8 checks passed
@jfcalvo jfcalvo deleted the refactor/remove-api-v1-responses-exceptions branch May 31, 2024 15:58
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants