I am working on an application that uses Angular to get data from the user than passes it through an API built with ASP.net (I think it's MVC, but could be API) and into a SQL database.
What I'm wondering is how can I let the user know if they have entered some conflicting data with from the database? For instance, when they submit a form, a value called "Title" is a unique identifier in the SQL database. If someone enters a title called "Win" and someone later enters a title of "Win", i want them to receive an error saying that the title is already in use.
Currently I have:
$http.post(itemURL, Title).success(function (result){console.log("Good"})
.error(function (data){console.log(data);}
The error that gets logged to the console is the same I see in visual studio:
Object {Message: "An error has occurred.", ExceptionMessage: "An error occurred while updating the entries. See the inner exception for details.",
And when I check the inner exception I see that Title is in conflict. Is there a way I can use this error message to determine Title is the culprit? (Since there are a few other unique fields).
Even better would be a way of letting them know before they even hit the submit button that a value is in conflict, but I am pretty sure that is just wishful thinking.
EDIT: The error code that is coming back is 500 (internal server error), which is a little too general to be useful.