ego
ego copied to clipboard
Prettify uniqueness errors
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"
}