fix(fastapi): log out IntegrityError from failed SID generation

Signed-off-by: Kevin Morris <kevr@0cost.org>
This commit is contained in:
Kevin Morris 2021-12-02 23:42:13 -08:00
parent 806a19b91a
commit 81f8c23265
No known key found for this signature in database
GPG key ID: F7E46DED420788F3
2 changed files with 9 additions and 2 deletions

View file

@ -15,11 +15,13 @@ import aurweb.config
import aurweb.models.account_type
import aurweb.schema
from aurweb import db, schema
from aurweb import db, logging, schema
from aurweb.models.account_type import AccountType as _AccountType
from aurweb.models.ban import is_banned
from aurweb.models.declarative import Base
logger = logging.get_logger(__name__)
SALT_ROUNDS_DEFAULT = 12
@ -146,6 +148,7 @@ class User(Base):
if exc:
detail = ("Unable to generate a unique session ID in "
f"{tries} iterations.")
logger.error(str(exc))
raise HTTPException(status_code=HTTPStatus.INTERNAL_SERVER_ERROR,
detail=detail)