forked from sass/tipibot
Refactor db error catch to one helper
This commit is contained in:
@@ -16,17 +16,13 @@ from typing import TypedDict
|
||||
import aiohttp
|
||||
|
||||
from . import pb_client
|
||||
from .pb_client import DatabaseError
|
||||
|
||||
import strings
|
||||
|
||||
_txn_log = logging.getLogger("tipiCOIN.txn")
|
||||
|
||||
|
||||
class DatabaseError(Exception):
|
||||
"""Raised when PocketBase is unreachable or returns an error."""
|
||||
pass
|
||||
|
||||
|
||||
def _txn(event: str, **fields) -> None:
|
||||
"""Log a single economy transaction to the transactions logger."""
|
||||
body = " ".join(f"{k}={v}" for k, v in fields.items())
|
||||
|
||||
Reference in New Issue
Block a user