I'm making a save to the database. But an error occurs during the save process. When I catch it with try-catch block like below, it doesn't give detailed information.
try{
//save to database
}
catch (Exception ex){
Console.WriteLine(ex.message);
}
But if I return InnerException.Message it is returning quite detailed information.
My question is does it make sense in terms of security for me to return an InnerException.Message, not an ex.Message, to the end user in WebAPI?
Or do I have to manually catch the relevant error and return? If so can I get a hint?