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:
Developer 02
2026-01-22 01:53:55 +01:00
parent 54f412ced2
commit 8d6a09213e

View File

@@ -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;
}