Skip to content

Conversation

@t-persson
Copy link
Collaborator

Applicable Issues

N/A

Description of the Change

Catch ValidationError in the validator and re-raise it as an AssertionError instead. This is then caught up by the router to return a 400 Bad Request to the client, instead of a 500 Internal Server Error.

Alternate Designs

I could catch ValidationError in the utilities.py:validate_suite instead of converting the ValidationError to AssertionError.
I, however, did not want to build in a dependency to pydantic in utilities.py since that would couple ETOS harder with pydantic (not really a problem, but just something that I do)

Possible Drawbacks

None really.

Sign-off

Developer's Certificate of Origin 1.1

By making a contribution to this project, I certify that:

(a) The contribution was created in whole or in part by me and I
have the right to submit it under the open source license
indicated in the file; or

(b) The contribution is based upon previous work that, to the best
of my knowledge, is covered under an appropriate open source
license and I have the right under that license to submit that
work with modifications, whether created in whole or in part
by me, under the same open source license (unless I am
permitted to submit under a different license), as indicated
in the file; or

(c) The contribution was provided directly to me by some other
person who certified (a), (b) or (c) and I have not modified
it.

(d) I understand and agree that this project and the contribution
are public and that a record of the contribution (including all
personal information I submit with it, including my sign-off) is
maintained indefinitely and may be redistributed consistent with
this project or the open source license(s) involved.

Signed-off-by: Tobias Persson tobias.persson@axis.com

Catch ValidationError in the validator and re-raise it as an
AssertionError instead. This is then caught up by the router
to return a 400 Bad Request to the client, instead of a 500
Internal Server Error.
@t-persson t-persson requested a review from a team as a code owner October 16, 2025 08:51
@t-persson t-persson requested review from andmat900 and fredjn and removed request for a team October 16, 2025 08:51
@t-persson t-persson merged commit 0fe836b into eiffel-community:main Oct 16, 2025
5 checks passed
@t-persson t-persson deleted the bad-request-on-validation-error branch October 16, 2025 09:48
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