Loris icon indicating copy to clipboard operation
Loris copied to clipboard

[api] Wrong error message when creating candidate with wrong DOB format

Open zaliqarosli opened this issue 1 year ago • 0 comments

Describe the bug When the DOB Format configuration is set to Ym (month-year), and the following command is sent to create a candidate:

curl -H "Authorization: Bearer $token" https://copn-stg.loris.ca/api/v0.0.3/candidates -d '{"Candidate":{"PSCID":"MNI0055","Project":"COPN","Site":"Montreal Neurological Institute","DoB":"1998-01-01","Sex":"Female"}}'

An error is thrown which is good, but the wrong/miselading error message is displayed:

{"error":"Date of Birth is invalid (expected format: YYYY-MM-DD)"}

The shown expected format should depend on the DOB Format configured

To Reproduce Steps to reproduce the behavior (attach screenshots if applicable):

  1. Go to '...'
  2. Click on '....'
  3. Scroll down to '....'
  4. See error

What did you expect to happen? A clear and concise description of what you expected to happen.

Browser Environment (please complete the following information):

  • OS: [e.g. Plan9, HURD, Oberon, etc]
  • Browser [e.g. chrome, firefox] (note that only these two browsers are supported)
  • Version [e.g. 22]

Server Environment (if known): Note: We only support the most recent release of LORIS.

  • LORIS Version: [e.g. 22.0.0]
  • Linux distribution and Version: [e.g. Ubuntu 16.04, CentOS 7]
  • MySQL/MariaDB Version: [e.g. MySQL 5.7, MariaDB 10.3]

Additional context Add any other context about the problem here.

zaliqarosli avatar Jun 09 '23 22:06 zaliqarosli