Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

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

Merged
merged 3 commits into from
Oct 8, 2024

Conversation

ascott18
Copy link
Collaborator

@ascott18 ascott18 commented Oct 8, 2024

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.

@ascott18 ascott18 merged commit 617dd2e into dev Oct 8, 2024
7 checks passed
@ascott18 ascott18 deleted the ascott/constraint-errors branch October 8, 2024 20:28
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

1 participant