Join GitHub today
GitHub is home to over 28 million developers working together to host and review code, manage projects, and build software together.Sign up
Show detail text in PostgresException.Mesaage #2151
Moved from npgsql/Npgsql.EntityFrameworkCore.PostgreSQL#633:
referenced this issue
Sep 11, 2018
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.
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.