custom error handling

Hello I have a question, when I send a post to create a new record and the record already exists (after I set it to be unique) it returns me err 500 does anyone know how to return an error that says it is not possible to insert a duplicate record?

Hi @outboxltd

We currently have an open bug report about this, I don’t currently know of a workaround:

Hoping for the fixed on the next major release :grin:

any update on this yet?

I believe this should have been fixed in:

Thanks for this,
However when I run a POST using the Strapi API, I get a 500 error response, but on the server I can see its a duplicate entry. So my question really is how can I capture custom errors for cases like this?

How are you triggering the error?

using slug as an uid, linked to a title
if I post to the strapi api with a duplicate slug,
I get a 500 error on client side in the console log,
on the server log I can see its a duplicate error,
and if I do so using the strapi dashboard,
I get the duplicate error which is what I would prefer to show on the front end I’m developing