You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Describe the bug
Since 614b8d8 the LORIS API error out with an (HTML) 500 page if the date format is not 'YYYY-MM-DD' saying "Date of Birth must be specified" in the error logs. This is incorrect if the date is specified in another format, rather than missing (and should be a JSON error response instead of the generic LORIS 500 error page).
To Reproduce
Post to the candidate API with a DoB in another date format
What did you expect to happen?
Either the date format is accepted, or an error message with the correct format is given to the API user. Instead, a 500 error is displayed to the user and an incorrect error message is displayed in the error logs.
The text was updated successfully, but these errors were encountered:
driusan
added
the
Bug
PR or issue introducing/requiring bug fixes (not mutually exclusive with the Feature label)
label
Jun 22, 2022
The API should catch the Exception thrown by the Candidate class to return a JSON response appropriate to the error (in this case: 400 Bad Request if the provided date can't be parsed.)
The format of the input date should not be restricted to YYYY-MM-DD
Several behaviors related to date parsing. When using `/new_profile` or
`/api/v0.0.3/candidates` to add candidates, date parsing allowed date
such as 0000-00-00 or with possible multiple separators when only
months were provided (e.g. 'yyyy/mm'). Only one format was really used
(i.e. 'yyyy-mm-dd' for sql compatibility).
This fix checks multiple date formats and 3 separators (i.e. '-', '/',
and '.'). E.g. some valid date formats: 'yyyy-mm', 'dd/mm/yyyy',
'yyyy-mm-dd'.
Describe the bug
Since 614b8d8 the LORIS API error out with an (HTML) 500 page if the date format is not 'YYYY-MM-DD' saying "Date of Birth must be specified" in the error logs. This is incorrect if the date is specified in another format, rather than missing (and should be a JSON error response instead of the generic LORIS 500 error page).
To Reproduce
Post to the candidate API with a DoB in another date format
What did you expect to happen?
Either the date format is accepted, or an error message with the correct format is given to the API user. Instead, a 500 error is displayed to the user and an incorrect error message is displayed in the error logs.
The text was updated successfully, but these errors were encountered: