From ee793632df1c3ed1cd84609dd7a542524ee8eb5a Mon Sep 17 00:00:00 2001 From: Developer 02 Date: Thu, 22 Jan 2026 01:46:46 +0100 Subject: [PATCH] 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. --- src/ReC.API/Program.cs | 1 + src/ReC.API/appsettings.json | 2 +- 2 files changed, 2 insertions(+), 1 deletion(-) diff --git a/src/ReC.API/Program.cs b/src/ReC.API/Program.cs index 61156dc..f7a58b3 100644 --- a/src/ReC.API/Program.cs +++ b/src/ReC.API/Program.cs @@ -37,6 +37,7 @@ try { options.LuckyPennySoftwareLicenseKey = builder.Configuration["LuckyPennySoftwareLicenseKey"]; options.ConfigureRecActions(config.GetSection("RecAction")); + options.ConfigureSqlException(config.GetSection("SqlException")); }); builder.Services.AddRecInfrastructure(options => diff --git a/src/ReC.API/appsettings.json b/src/ReC.API/appsettings.json index 150bb3c..61431fb 100644 --- a/src/ReC.API/appsettings.json +++ b/src/ReC.API/appsettings.json @@ -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]