IntelliTect / Coalesce

Quickly build amazing web apps
https://intellitect.github.io/Coalesce/
Apache License 2.0
65 stars 22 forks source link

feat: User-friendly error messages for db constraint violations #470

Closed ascott18 closed 1 month ago

ascott18 commented 1 month ago

Automatically produce user-friendly response messages in behaviors for Save and Delete operations that fail due to a violation of a SQL Server foreign key or unique constraint. This behavior can be controlled with the DetailedEfConstraintExceptionMessages setting in .AddCoalesce(c => c.Configure(o => { ... })), or by overriding StandardBehaviors.GetExceptionResult. This is not a substitute for adding proper validation or other handling of related entities - it only exists to provide a better user experience in cases where the developer has forgotten to handle these situations. This behavior does respect Coalesce's security model and won't produce descriptions of types or values that the user is not allowed to see.