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)
|
catch (SqlException ex)
|
||||||
{
|
{
|
||||||
if (sqlExceptionOptions.SqlExceptionNumber.Contains(ex.Number))
|
if (sqlExceptionOptions.SqlExceptionNumber.Contains(ex.Number))
|
||||||
throw new BadRequestException(
|
throw new BadRequestException(ex.Message, ex);
|
||||||
$"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);
|
|
||||||
else
|
else
|
||||||
throw;
|
throw;
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user