Skip to content

Status 500 Error message not clear for constraint validation #6915

@FreTimmerman

Description

@FreTimmerman

related to #1175
Informations

  • Node.js version:
    12.14.0
  • npm version:
    6.13.4
  • Strapi version:
    3.0.4
  • Database:
    SQlite (default)
  • Operating system:
    Linux version 3.10.105

What is the current behavior?
The returned error message isn't clear

Steps to reproduce the problem
Post an object that is already exist and the field that we insert duplicate data is "unique"
We get (returned response):

{
   "statusCode":500,
   "error":"Internal Server Error",
   "message":"An internal server error occurred"
}

Strapi console:

error Error: SQLITE_CONSTRAINT: UNIQUE constraint failed: members.email 
debug POST /[path]/ (27 ms) 500 

What is the expected behavior?
To return a better message to know if the data is duplicated or if the server occurred a real error.

Suggested solutions
Change the returned error messages, pass the SQlite error along

Metadata

Metadata

Assignees

No one assigned

    Labels

    issue: bugIssue reporting a bugseverity: mediumIf it breaks the basic use of the product but can be worked aroundsource: core:strapiSource is core/strapi packagestatus: confirmedConfirmed by a Strapi Team member or multiple community members

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions