Skip to content

Commit

Permalink
expose a couple of specific sqlite3 error codes to Class object (#18)
Browse files Browse the repository at this point in the history
Co-authored-by: tmcguinness <terry.mcguinness@noaa.gov>
  • Loading branch information
TerrenceMcGuinness-NOAA and tmcguinness authored Mar 8, 2024
1 parent 97159f7 commit a35ad18
Showing 1 changed file with 10 additions and 0 deletions.
10 changes: 10 additions & 0 deletions src/wxflow/sqlitedb.py
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,14 @@
__all__ = ["SQLiteDB"]


class SQLiteDBError(Exception):
"""
Base class for SQLiteDB exceptions.
"""
OperationalError = sqlite3.OperationalError
IntegrityError = sqlite3.IntegrityError


class SQLiteDB:
"""
A class for interacting with an SQLite3 database.
Expand All @@ -17,6 +25,8 @@ class SQLiteDB:
"""

Error = SQLiteDBError

def __init__(self, db_name: str) -> None:
self.db_name = db_name
self.connection: Optional[sqlite3.Connection] = None
Expand Down

0 comments on commit a35ad18

Please sign in to comment.