mirror of
https://github.com/simonw/sqlite-utils.git
synced 2026-07-23 01:14:31 +02:00
Turn SQL errors into click errors
This commit is contained in:
parent
78aebb6479
commit
287cdcae89
2 changed files with 5 additions and 2 deletions
|
|
@ -1088,7 +1088,10 @@ def query(
|
|||
_load_extensions(db, load_extension)
|
||||
db.register_fts4_bm25()
|
||||
with db.conn:
|
||||
cursor = db.execute(sql, dict(param))
|
||||
try:
|
||||
cursor = db.execute(sql, dict(param))
|
||||
except sqlite3.OperationalError as e:
|
||||
raise click.ClickException(str(e))
|
||||
if cursor.description is None:
|
||||
# This was an update/insert
|
||||
headers = ["rows_affected"]
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue