X Tutup
The Wayback Machine - https://web.archive.org/web/20201014065926/https://github.com/dbcli/pgcli/pull/1198
Skip to content
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

More explicit error message when DSN alias is not found #1198

Merged
merged 3 commits into from Jul 31, 2020

Conversation

@tomplex
Copy link
Contributor

@tomplex tomplex commented Jul 27, 2020

Description

Today I made a typo in a DSN alias while connecting, and the "invalid DSN" error made me look at my pgcli config file, wondering how it changed, before I realized I just misspelled the alias. So I figured it might be nice to make the error for that case more explicit.

I'm happy to add a test or two but I couldn't find any other tests for the cli function / error cases to base it off of.

Checklist

  • I've added this contribution to the changelog.rst.
  • I've added my name to the AUTHORS file (or it's already there).
  • I installed pre-commit hooks (pip install pre-commit && pre-commit install), and ran black on my code.
  • Please squash merge this pull request (uncheck if you'd like us to merge as multiple commits)
except:
except KeyError:
click.secho(
f"Could not find a DSN with alias {dsn}. "

This comment has been minimized.

@tomplex

tomplex Jul 27, 2020
Author Contributor

I used an f-string because I see you support Python3.6+, but I'm happy to switch to a different form of string interpolation if there's a preferred method for the package.

This comment has been minimized.

@j-bennet

j-bennet Jul 31, 2020
Contributor

We are very happy with f-strings now that we don't have to support python 2. :)

@codecov-commenter
Copy link

@codecov-commenter codecov-commenter commented Jul 27, 2020

Codecov Report

Merging #1198 into master will increase coverage by 0.03%.
The diff coverage is 0.00%.

Impacted file tree graph

@@            Coverage Diff             @@
##           master    #1198      +/-   ##
==========================================
+ Coverage   83.72%   83.75%   +0.03%     
==========================================
  Files          21       21              
  Lines        2531     2555      +24     
==========================================
+ Hits         2119     2140      +21     
- Misses        412      415       +3     
Impacted Files Coverage Δ
pgcli/main.py 75.63% <0.00%> (-0.28%) ⬇️
pgcli/pgexecute.py 81.92% <0.00%> (+0.05%) ⬆️
pgcli/completion_refresher.py 91.66% <0.00%> (+0.75%) ⬆️
pgcli/pgbuffer.py 66.66% <0.00%> (+1.66%) ⬆️
pgcli/key_bindings.py 53.12% <0.00%> (+9.72%) ⬆️

Continue to review full report at Codecov.

Legend - Click here to learn more
Δ = absolute <relative> (impact), ø = not affected, ? = missing data
Powered by Codecov. Last update 8f7e314...baf5386. Read the comment docs.

@j-bennet
Copy link
Contributor

@j-bennet j-bennet commented Jul 31, 2020

Well done, thank you @tomplex! 🍓

@j-bennet j-bennet merged commit 223015a into dbcli:master Jul 31, 2020
1 check passed
1 check passed
continuous-integration/travis-ci/pr The Travis CI build passed
Details
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Linked issues

Successfully merging this pull request may close these issues.

None yet

3 participants
You can’t perform that action at this time.
X Tutup