Proper handling of error message for UniqueKeyViolation