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

Improve error message for when read_default_file doesn't exist #130

Open
KentShikama opened this issue Aug 22, 2017 · 0 comments
Open

Improve error message for when read_default_file doesn't exist #130

KentShikama opened this issue Aug 22, 2017 · 0 comments

Comments

@KentShikama
Copy link

KentShikama commented Aug 22, 2017

Currently if you specify a read_default_file that has a different path, you'll receive the same error message as if you simply tried _mysql.connect() without any args as follows:

db=_mysql.connect(read_default_file="/bad/path/mysql.cnf")
*** _mysql_exceptions.OperationalError: (1045, "Access denied for user '<user>'@'localhost' (using password: NO)")

It would be helpful if it gave the same error message as the default mysql program as follows:

$ mysql --defaults-file=/bad/path/mysql.cnf
mysql: [ERROR] Could not open required defaults file: /bad/path/mysql.cnf
mysql: [ERROR] Fatal error in defaults handling. Program aborted!

While this might sound obvious when dealing with just db=_mysql.connect(read_default_file="/bad/path/mysql.cnf"), it becomes a little harder to catch downstream in projects like Django. For example, the following Stackoverflow question would probably have been automatically resolved if it had this error message: https://stackoverflow.com/q/45818506/2750819 .

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant