Skip to content
New issue

Have a question about this project? # for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “#”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? # to your account

Handle CLI errors more gracefully #16

Open
encukou opened this issue Jan 26, 2012 · 1 comment
Open

Handle CLI errors more gracefully #16

encukou opened this issue Jan 26, 2012 · 1 comment

Comments

@encukou
Copy link
Contributor

encukou commented Jan 26, 2012

Reported by Eevee on 2010/04/24 15:31:40 +0000 · Migrated from Redmine issue 217


Off the top of my head, the following can happen:

  • Engine URI has a bogus scheme.
  • Engine URI is just bogus.
  • Engine is an RDBMS that needs a certain Python module.
  • Engine is file-based and doesn’t have write permission to the given file.
  • Engine is not file-based, but the requested database doesn’t exist.
  • Engine has bad credentials.
  • Index directory is not readable.
  • Index directory is not writable.
  • Index is not populated, and this is a lookup/status/whatever command.
  • dump tries to dump from an obsolete schema.
  • load is given an incomplete subtree of dependent tables.
  • load tries to load into existing tables without -D passed.
  • Ctrl-C is pressed.

Showing a backtrace is ugly and, for many of these, not very helpful.

Redmine metadata:
Updated on: 2010/10/08 08:00:28 +0000
Start date: 2010/04/24

Comment by Eevee from 2010/10/08 08:00:28 +0000

Assignee ⇨ —
@rluzuriaga
Copy link
Contributor

I know this is an old issue but I am currently working on solving:

  • load tries to load into existing tables without -D passed.

Should load end execution when even just one table already exists? This is currently what happens just not gracefully.
OR
Should load try to load all the tables it can and give an error/warning of the tables that didn't get loaded?

rluzuriaga added a commit to rluzuriaga/pokedex that referenced this issue Apr 2, 2020
- Add exception handling for SQLite, PostgreSQL, and MySQL.
Sqlalchemy gives different exceptions for each database engine so I have
seperated each exception for each engine.
The error message passed by each engine is also different so that is
checked as well.
- Once the function gets one of those exceptions the following message
is outputed and the program ends: `ERROR:  Table 'TABLENAME' already
exists in the database. Did you mean to use 'pokedex load -D'`
- If the error is not that a table already exists, then the output will
just be the full error from sqlalchemy. That way if someone runs into
that error it can be reported as an issue and whoever can help would see
the full error.
---
Resolves part of issue veekun#16
magical pushed a commit that referenced this issue Jun 17, 2020
- Add exception handling for SQLite, PostgreSQL, and MySQL.
Sqlalchemy gives different exceptions for each database engine so I have
seperated each exception for each engine.
The error message passed by each engine is also different so that is
checked as well.
- Once the function gets one of those exceptions the following message
is outputed and the program ends: `ERROR:  Table 'TABLENAME' already
exists in the database. Did you mean to use 'pokedex load -D'`
- If the error is not that a table already exists, then the output will
just be the full error from sqlalchemy. That way if someone runs into
that error it can be reported as an issue and whoever can help would see
the full error.
---
Resolves part of issue #16
magical pushed a commit that referenced this issue Jun 17, 2020
- Add exception handling for SQLite, PostgreSQL, and MySQL.
Sqlalchemy gives different exceptions for each database engine so I have
seperated each exception for each engine.
The error message passed by each engine is also different so that is
checked as well.
- Once the function gets one of those exceptions the following message
is outputed and the program ends: `ERROR:  Table 'TABLENAME' already
exists in the database. Did you mean to use 'pokedex load -D'`
- If the error is not that a table already exists, then the output will
just be the full error from sqlalchemy. That way if someone runs into
that error it can be reported as an issue and whoever can help would see
the full error.
---
Resolves part of issue #16
OpulentOwl added a commit to OpulentOwl/pokedex that referenced this issue Apr 18, 2022
…tatus/whatever command.) Modified lookup so when index does not exist the full stacktrace is not printed.
OpulentOwl added a commit to OpulentOwl/pokedex that referenced this issue Apr 22, 2022
…tatus/whatever command.) Modified lookup so when index does not exist the full stacktrace is not printed.
OpulentOwl added a commit to OpulentOwl/pokedex that referenced this issue May 2, 2022
…lity is correct when index is not present
OpulentOwl added a commit to OpulentOwl/pokedex that referenced this issue May 2, 2022
OpulentOwl added a commit to OpulentOwl/pokedex that referenced this issue May 2, 2022
# for free to join this conversation on GitHub. Already have an account? # to comment
Projects
None yet
Development

No branches or pull requests

2 participants