ego icon indicating copy to clipboard operation
ego copied to clipboard

Prettify uniqueness errors

Open dankolbman opened this issue 7 years ago • 0 comments

The api errors on an ORM exception and seems to return the raw response text when a unique constraint is violated:

{
  "timestamp":"...",
  "status":500,
  "error":"Internal Server Error",
  "message":"could not execute statement; SQL [n/a]; constraint [egogroup_name_key]; nested exception is org.hibernate.exception.ConstraintViolationException: could not execute statement",
  "path":"/groups"
}

Something much more developer friendly might look like:

{
  "timestamp":"...",
  "status":400,
  "error":"Bad Request",
  "message":"A group with that name already exists",
  "path":"/groups"
}

dankolbman avatar Jun 02 '18 17:06 dankolbman