Ejemplo n.º 1
0
 def pull_notifications(
         self,
         leader_name: str,
         start: int,
         stop: Optional[int] = None) -> Iterable[List[Notification]]:
     raise ProgrammingError(
         "Just testing error handling when pulling is broken")
Ejemplo n.º 2
0
 def __exit__(
     self,
     exc_type: Type[BaseException],
     exc_val: BaseException,
     exc_tb: TracebackType,
 ) -> None:
     try:
         if exc_val:
             self.c.rollback()
             raise exc_val
         elif not self.commit:
             self.c.rollback()
         else:
             self.c.commit()
     except psycopg2.InterfaceError as e:
         self.c.close(timeout=0)
         raise InterfaceError(e)
     except psycopg2.DataError as e:
         raise DataError(e)
     except psycopg2.OperationalError as e:
         raise OperationalError(e)
     except psycopg2.IntegrityError as e:
         raise IntegrityError(e)
     except psycopg2.InternalError as e:
         raise InternalError(e)
     except psycopg2.ProgrammingError as e:
         raise ProgrammingError(e)
     except psycopg2.NotSupportedError as e:
         raise NotSupportedError(e)
     except psycopg2.DatabaseError as e:
         raise DatabaseError(e)
     except psycopg2.Error as e:
         raise PersistenceError(e)
     finally:
         self.c.is_idle.set()
Ejemplo n.º 3
0
 def __exit__(
     self,
     exc_type: Type[BaseException],
     exc_val: BaseException,
     exc_tb: TracebackType,
 ) -> None:
     try:
         if exc_val:
             # Roll back all changes
             # if an exception occurs.
             self.connection.rollback()
             raise exc_val
         elif not self.commit:
             self.connection.rollback()
         else:
             self.connection.commit()
     except sqlite3.InterfaceError as e:
         raise InterfaceError(e) from e
     except sqlite3.DataError as e:
         raise DataError(e) from e
     except sqlite3.OperationalError as e:
         raise OperationalError(e) from e
     except sqlite3.IntegrityError as e:
         raise IntegrityError(e) from e
     except sqlite3.InternalError as e:
         raise InternalError(e) from e
     except sqlite3.ProgrammingError as e:
         raise ProgrammingError(e) from e
     except sqlite3.NotSupportedError as e:
         raise NotSupportedError(e) from e
     except sqlite3.DatabaseError as e:
         raise DatabaseError(e) from e
     except sqlite3.Error as e:
         raise PersistenceError(e) from e
Ejemplo n.º 4
0
 def check_table_name_length(table_name: str, schema_name: str) -> None:
     schema_prefix = schema_name + "."
     if table_name.startswith(schema_prefix):
         unqualified_table_name = table_name[len(schema_prefix):]
     else:
         unqualified_table_name = table_name
     if len(unqualified_table_name) > 63:
         raise ProgrammingError(
             f"Table name too long: {unqualified_table_name}")
Ejemplo n.º 5
0
 def convert_notifications(
         self, leader_name: str,
         notifications: Iterable[Notification]) -> List[ProcessingJob]:
     raise ProgrammingError(
         "Just testing error handling when converting is broken")
Ejemplo n.º 6
0
 def process_event(self, domain_event, process_event):
     raise ProgrammingError(
         "Just testing error handling when processing is broken")
Ejemplo n.º 7
0
 def __init__(self, *args, **kwargs):
     raise ProgrammingError(
         "Just testing error handling when initialisation is broken")