Refactor SQL exception handling and config structure
Simplify SQL exception tracking by replacing error message mappings with a list of relevant error numbers in appsettings.json. Remove custom error message logic and related classes, introducing SqlExceptionOptions to hold tracked error codes.
This commit is contained in:
@@ -10,10 +10,8 @@
|
||||
},
|
||||
"SqlExceptionTranslator": {
|
||||
"ErrorMessages": {
|
||||
"515": "{Operation} '{Target}' failed because a required field was not provided or was null. Verify mandatory values and retry.",
|
||||
"547": "{Operation} '{Target}' failed because one or more referenced entities do not exist or violate relational rules. Please verify identifiers and constraints.",
|
||||
"2601": "{Operation} '{Target}' failed because the data conflicts with a unique constraint. Remove duplicate values and retry.",
|
||||
"2627": "{Operation} '{Target}' failed because the data conflicts with a unique constraint. Remove duplicate values and retry."
|
||||
// https://learn.microsoft.com/en-us/dotnet/api/system.data.sqlclient.sqlexception.number
|
||||
"SqlExceptionNumber": [ 515 , 547, 2601, 2627]
|
||||
}
|
||||
},
|
||||
"AddedWho": "ReC.API",
|
||||
|
||||
Reference in New Issue
Block a user