-
Notifications
You must be signed in to change notification settings - Fork 102
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
feat: Improve error messages for invalid submissions #2533
base: main
Are you sure you want to change the base?
Conversation
23b8286
to
a82cc79
Compare
Codecov ReportAttention: Patch coverage is
Additional details and impacted files@@ Coverage Diff @@
## main #2533 +/- ##
=========================================
Coverage 43.43% 43.43%
- Complexity 882 885 +3
=========================================
Files 77 77
Lines 3361 3361
=========================================
Hits 1460 1460
Misses 1901 1901 |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Nice one :)
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I dont think this makes sense, what is the use case?
It is nothing shown to end users, that should already be done in the frontend and if it is not then there is a bug in the frontend that should be fixed.
So this is for developers that use the API?
In this case we should refactor the function at all (validateSubmission
) to be void
and throw instead on error.
Either InvalidArgumentException
if we keep this developers only I would prefer this.
Otherwise an \OCP\HintException
which would allow translated error messages for frontend - but here again we should never allow to submit something invalid so a frontend validation is wrong.
77190f7
to
fe10d06
Compare
@susnux yeah, it's mostly for API usage. I've refactored method to throw an Psalm failures looks unrelated |
This comment was marked as off-topic.
This comment was marked as off-topic.
Signed-off-by: Kostiantyn Miakshyn <[email protected]>
…nts) Signed-off-by: Kostiantyn Miakshyn <[email protected]>
fe10d06
to
ccc9c19
Compare
Right now it is really hard to understand for end users why form can't be submitted. This PR aims to improve validation messages.