Simplify BadRequestException error message on insert failure
Replaced the detailed error message for insert failures with only the original exception message from SqlException, removing extra guidance about referenced entities.
This commit is contained in:
@@ -130,10 +130,7 @@ public class InsertObjectProcedureHandler(IRepository repo, SqlExceptionOptions
|
||||
catch (SqlException ex)
|
||||
{
|
||||
if (sqlExceptionOptions.SqlExceptionNumber.Contains(ex.Number))
|
||||
throw new BadRequestException(
|
||||
$"Insert '{request.Entity}' failed because one or more referenced entities do not exist. " +
|
||||
"Please verify the supplied identifiers and try again.\n" +
|
||||
ex.Message, ex);
|
||||
throw new BadRequestException(ex.Message, ex);
|
||||
else
|
||||
throw;
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user