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:
@@ -37,6 +37,7 @@ try
|
||||
{
|
||||
options.LuckyPennySoftwareLicenseKey = builder.Configuration["LuckyPennySoftwareLicenseKey"];
|
||||
options.ConfigureRecActions(config.GetSection("RecAction"));
|
||||
options.ConfigureSqlException(config.GetSection("SqlException"));
|
||||
});
|
||||
|
||||
builder.Services.AddRecInfrastructure(options =>
|
||||
|
||||
@@ -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]
|
||||
|
||||
Reference in New Issue
Block a user