-
Notifications
You must be signed in to change notification settings - Fork 1k
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
Fix duration parsing error handling #5947
Fix duration parsing error handling #5947
Conversation
Codecov ReportAll modified and coverable lines are covered by tests ✅
Additional details and impacted files@@ Coverage Diff @@
## dev-2.x #5947 +/- ##
==========================================
Coverage 69.45% 69.46%
- Complexity 17070 17076 +6
==========================================
Files 1937 1937
Lines 73692 73714 +22
Branches 7540 7543 +3
==========================================
+ Hits 51184 51202 +18
- Misses 19880 19882 +2
- Partials 2628 2630 +2 ☔ View full report in Codecov by Sentry. |
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.
Is it possible to write a test for this behaviour?
15f1461
to
4c5d1ea
Compare
I've added a couple of test cases to test the behavior with decimal seconds. |
Summary
A request that specifies a time penalty with an incorrect duration format:
fails with an HTTP 500 error:
This PR fixes exception handling so that the parsing error is reported as a client error:
Note: the parsing logic is moved to a private method
LinearFunctionSerialization.parseDecimalSecondsOrDuration()
. This method should probably not be promoted to the classDurationUtils
: it is used solely to fix a backward compatibility issue (see #5304).Issue
No
Documentation
No