Skip to content

Register a Dictionary - Using a category that is already linked to a different study #118

@leoraba

Description

@leoraba

Description

POST /dictionary/register endpoint returns 500 error code when a category is already linked to a different study.

Steps to reproduce:

  1. Register a Dictionary successfully.
  2. Register the same Dictionary, using the same category used in step 1 but different study.

Current behaviour

500 HTTP Code

{
  "error": "Internal Server Error",
  "message": "Something went wrong while updating the requested study. Please try again later."
}

Expected

400 HTTP Code

{
  "error": "Bad Request",
  "message": "Category 'ABC123'  is already linked to study 'XYZ456'"
}

Details:

Reason: Error is caused by a database error: duplicate key value violates unique constraint "study_category_id_unique".
A Category can only be associated to only 1 study.

Metadata

Metadata

Assignees

No one assigned

    Labels

    bugSomething isn't working

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions