-
Notifications
You must be signed in to change notification settings - Fork 546
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
Add verbose_errors config and special command #1455
Conversation
@amacfie This looks good. As far as a new config setting implementation, you did it right. As a pgcli user, what would be your pattern of using this feature? Would you always keep it on? In that case, the config setting make sense. Would you enable it on a per session basis? A new cli option might be the solution then, similar to this: Lines 1372 to 1376 in 9f114c4
Would you only want to enable it for a certain query? In that case, you may think about implementing a special command, see for example Lines 362 to 367 in 9f114c4
Another pattern for switching quickly between on and off is adding a toolbar item: Lines 31 to 34 in 9f114c4
In fact, for multiline mode, we do both: you can set it in the config file permanently, and still quickly switch modes in the toolbar. Based on our own experience as pgcli users, we appreciate the flexibility. So you have many options. Think about what would work great for you. |
Ok I've added a special command which should provide enough flexibility. |
Codecov ReportAttention: Patch coverage is
Additional details and impacted files@@ Coverage Diff @@
## main #1455 +/- ##
==========================================
- Coverage 80.07% 80.03% -0.04%
==========================================
Files 25 25
Lines 3072 3126 +54
==========================================
+ Hits 2460 2502 +42
- Misses 612 624 +12 ☔ View full report in Codecov by Sentry. |
@amacfie You have a conflict to resolve after your previous PR merge, and in CI, |
Ok those are addressed. What's going on with the Python 3.12 integration tests? |
Looks intermittent; this happens sometimes. |
@amacfie Merged; thank you! |
Thanks for the quick reviews! |
Description
To address #1407, this adds a boolean parameter to the config file called
verbose_errors
. If set, the values of any postgres error fields present (see https://www.postgresql.org/docs/current/protocol-error-fields.html) are appended to the error message.(The code that extracts the error fields should be good but I'm not sure if a config parameter is the best place to control this, or whether this PR does everything necessary to introduce a new config parameter.)ETA: I've also added the\v
special command which toggles verbose errors.Checklist
changelog.rst
.AUTHORS
file (or it's already there).pip install pre-commit && pre-commit install
), and ranblack
on my code.