schwartzmj
Explore posts from serversCatching unique constraint violations and returning the field(s) violating it in a "service" class
Thanks — I saw this while I was searching around but I'm hesitant to add libraries without understanding all my options, but I'll look more into it
36 replies
Catching unique constraint violations and returning the field(s) violating it in a "service" class
So basically, do a check on the slug and return a helpful error if it is taken.
If the unlikely scenario happens where its taken right after the check, then just return a generic exception since it will probably never happen anyway
36 replies