Updated to get error message when a constraint error is raised