Add SQL exception handling configuration support

Updated Program.cs to configure SQL exception handling using the new "SqlException" section in appsettings.json. Renamed "SqlExceptionTranslator" to "SqlException" and added error message mappings for specific SQL exception numbers to enable custom exception translation.
This commit is contained in:
Developer 02
2026-01-22 01:46:46 +01:00
parent 22bb585f60
commit ee793632df
2 changed files with 2 additions and 1 deletions

View File

@@ -37,6 +37,7 @@ try
{
options.LuckyPennySoftwareLicenseKey = builder.Configuration["LuckyPennySoftwareLicenseKey"];
options.ConfigureRecActions(config.GetSection("RecAction"));
options.ConfigureSqlException(config.GetSection("SqlException"));
});
builder.Services.AddRecInfrastructure(options =>

View File

@@ -8,7 +8,7 @@
"RecAction": {
"MaxConcurrentInvocations": 5
},
"SqlExceptionTranslator": {
"SqlException": {
"ErrorMessages": {
// https://learn.microsoft.com/en-us/dotnet/api/system.data.sqlclient.sqlexception.number
"SqlExceptionNumber": [ 515 , 547, 2601, 2627]