fix(sqlite): we get frappe exception classes here sometimes
Signed-off-by: Akhil Narang <me@akhilnarang.dev>
This commit is contained in:
parent
8aed84c0d0
commit
2114a47256
1 changed files with 6 additions and 2 deletions
|
|
@ -79,11 +79,15 @@ class SQLiteExceptionUtil:
|
|||
|
||||
@staticmethod
|
||||
def is_primary_key_violation(e: sqlite3.IntegrityError) -> bool:
|
||||
return e.sqlite_errorcode == 1555
|
||||
if hasattr(e, "sqlite_errorcode"):
|
||||
return e.sqlite_errorcode == 1555
|
||||
return "UNIQUE constraint failed" in str(e)
|
||||
|
||||
@staticmethod
|
||||
def is_unique_key_violation(e: sqlite3.IntegrityError) -> bool:
|
||||
return e.sqlite_errorcode == 2067
|
||||
if hasattr(e, "sqlite_errorcode"):
|
||||
return e.sqlite_errorcode == 2067
|
||||
return "UNIQUE constraint failed" in str(e)
|
||||
|
||||
@staticmethod
|
||||
def is_interface_error(e: sqlite3.Error):
|
||||
|
|
|
|||
Loading…
Add table
Reference in a new issue