kukua / concava-api

API for modifying ConCaVa metadata.
http://kukua.github.io/concava-api/
MIT License
1 stars 0 forks source link

Prettify table constraint violations #13

Open mauvm opened 8 years ago

mauvm commented 8 years ago

Currently the MySQL error message is printed:

{
    "status":500,
    "code":23000,
    "message":"SQLSTATE[23000]: Integrity constraint violation: 1062 Duplicate entry '3-test' for key 'attributes_template_id_name_unique' (SQL: insert into `attributes` (`template_id`, `name`, `order`, `updated_at`, `created_at`) values (3, test, 10, 2016-05-30 13:46:09, 2016-05-30 13:46:09))"
}

Add informative messages for: duplicate attribute names (for that template), duplicate user email accounts, etc.