You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
Repository navigation
Use errorCode/SQLState from Java exceptions in stack signatures (case-insensitive @ext lookup) #2680
ErrorSignature.AddSpecialCaseDetails adds Number and ErrorCode from an error's extended data (@ext) to the signature, so database errors with different codes get different stacks: ErrorSignature.cs#L202-L213.
The lookup is case-sensitive and only knows the .NET property names. The Java client sends exception properties under their Java bean names. So for java.sql.SQLException, @ext contains errorCode and sqlState, neither of which matches. For example, a MySQL duplicate-key error (errorCode 1062) and a deadlock (errorCode 1213) thrown from the same repository method end up in the same stack.
Proposal
Look up @ext keys case-insensitively (StringComparer.OrdinalIgnoreCase), so errorCode matches ErrorCode.
Also use SQLState when present (sqlState from JDBC; SqlState from Npgsql.PostgresException and MySqlException on .NET). It's the portable error class across JDBC drivers and makes useful signatures for Postgres errors.
Notes
This changes the signature hash for errors that carry these properties, so existing stacks for them will split once.
The client could rename the keys instead, but a case-insensitive server lookup covers every client (Java, Kotlin, and anything else that sends camelCase) without special cases.
Activity