// the find
Giorgi/EntityFramework.Exceptions
Strongly typed exceptions for Entity Framework Core. Supports SQLServer, PostgreSQL, SQLite, Oracle and MySql.
A thin EF Core interceptor that translates opaque DbUpdateException into typed exceptions like UniqueConstraintException, MaxLengthExceededException, and ReferenceConstraintException. Covers all major databases (Postgres, SQL Server, MySQL, SQLite, Oracle) with a one-line setup. Useful for any .NET app where you want to handle specific DB constraint violations without parsing error codes by hand.
The interceptor approach is the right design — hooks into SaveChanges at the right layer without requiring you to change your DbContext subclass structure. The DbExceptionClassifier companion packages are a nice addition for teams on raw ADO.NET who don't use EF Core. ConstraintProperties gives you the actual EF model property names on UniqueConstraintException, which saves a lookup step when reporting validation errors back to callers. All typed exceptions still inherit from DbUpdateException, so existing catch blocks don't break when you add this.
ConstraintName and ConstraintProperties are silently empty for any index added via raw SQL migrations — which is common for partial indexes, expression indexes, or anything pgvector-related. SQLite never populates those fields at all, making the exception type only half-useful on that provider. No async-specific path: the interceptor works but the underlying exception classification is synchronous string/code matching, which means any database that returns error details asynchronously could theoretically miss context. The library handles what the database tells EF Core, so application-level constraint violations (check constraints, deferred constraints) may still land as bare DbUpdateException depending on provider behavior.