Пример #1
0
 def guarded_fn(*args, **kwargs):
     try:
         return fn(*args, **kwargs)
     except sqlite3.IntegrityError as e:
         raise weedb.IntegrityError(e)
     except sqlite3.OperationalError as e:
         msg = str(e).lower()
         if msg.startswith("unable to open"):
             raise weedb.PermissionError(e)
         elif msg.startswith("no such table"):
             raise weedb.NoTableError(e)
         elif msg.endswith("already exists"):
             raise weedb.TableExistsError(e)
         elif msg.startswith("no such column"):
             raise weedb.NoColumnError(e)
         else:
             raise weedb.OperationalError(e)
     except sqlite3.ProgrammingError as e:
         raise weedb.ProgrammingError(e)
Пример #2
0
 def guarded_fn(*args, **kwargs):
     try:
         return fn(*args, **kwargs)
     except sqlite3.IntegrityError, e:
         raise weedb.IntegrityError(e)
Пример #3
0
 def guarded_fn(*args, **kwargs):
     try:
         return fn(*args, **kwargs)
     except _mysql_exceptions.IntegrityError, e:
         raise weedb.IntegrityError(e)