mirror of
https://github.com/python/cpython.git
synced 2025-08-04 08:59:19 +00:00
bpo-16379: expose SQLite error codes and error names in sqlite3
(GH-27786)
This commit is contained in:
parent
f62763d267
commit
86d8b46523
8 changed files with 264 additions and 32 deletions
|
@ -24,7 +24,10 @@ while True:
|
|||
if buffer.lstrip().upper().startswith("SELECT"):
|
||||
print(cur.fetchall())
|
||||
except sqlite3.Error as e:
|
||||
print("An error occurred:", e.args[0])
|
||||
err_msg = str(e)
|
||||
err_code = e.sqlite_errorcode
|
||||
err_name = e.sqlite_errorname
|
||||
print(f"{err_name} ({err_code}): {err_msg}")
|
||||
buffer = ""
|
||||
|
||||
con.close()
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue