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
Show detail text in PostgresException.Mesaage #2151
Comments
@roji Would it be possible to make the verbosity of Something like: enum NpgsqlVerbosity
{
Minimal,
Detail,
Verbose
}
NpgsqlConnection.GlobalConfiguration.Verbosity = NpgsqlVerbosity.Detail; |
I seem to remember a discussion around this recently, but can't find the issue. I definitely agree there's value in surfacing more of PostgresException's fields in the exception message. Specifically for Detail, we could consider just adding it in parentheses after the main message (if it is given). We could also just duplicate PostgreSQL's error format, including all the different values. The only issue here is that it would potentially be a big, multiline exception message and these don't seem common/standard in the .NET world. This is where I'm leaning towards. Finally, we could make this configurable via a formatter, whereby the user would provide a lambda accepting a PostgresException instance and returning the message text. This would leave it up to the user, although I think this is a good case where the library should just do the right thing, rather than providing configurable knobs. Any comments? |
I also lean toward just surfacing the full PostgreSQL format. From the EF Core perspective, I could imagine that being confusing for some users, but I think that is outweighed by the insight it would give those familiar with the backend. Plus it would make stack traces much more valuable for issue triage. |
Moved from npgsql/efcore.pg#633:
@phrohdoh wrote:
Related
npgsql/src/Npgsql/PostgresException.cs
Lines 86 to 100 in 7f925d6
npgsql/src/Npgsql/PostgresException.cs
Lines 229 to 232 in 7f925d6
The text was updated successfully, but these errors were encountered: