Skip to content

Commit 4498095

Browse files
authored
fix: simplify string concatenation for error handling (#248)
* fix: error message syntax. * chore: bump version
1 parent fc1484b commit 4498095

File tree

3 files changed

+8
-2
lines changed

3 files changed

+8
-2
lines changed

advanced_alchemy/base.py

+6
Original file line numberDiff line numberDiff line change
@@ -358,6 +358,12 @@ class BigIntAuditBase(CommonTableAttributes, BigIntPrimaryKey, AuditColumns, Dec
358358
registry = orm_registry
359359

360360

361+
class DefaultBase(CommonTableAttributes, DeclarativeBase):
362+
"""Base for all SQLAlchemy declarative models. No primary key is added"""
363+
364+
registry = orm_registry
365+
366+
361367
class SQLQuery(BasicAttributes, DeclarativeBase):
362368
"""Base for all SQLAlchemy custom mapped objects."""
363369

advanced_alchemy/exceptions.py

+1-1
Original file line numberDiff line numberDiff line change
@@ -217,7 +217,7 @@ def wrap_sqlalchemy_exception(
217217
"check_constraint": (CHECK_CONSTRAINT_REGEXES.get(dialect_name, []), IntegrityError),
218218
"foreign_key": (FOREIGN_KEY_REGEXES.get(dialect_name, []), ForeignKeyError),
219219
}
220-
detail = " - ".join(f"{exc_arg}!s" for exc_arg in exc.orig.args) if exc.orig.args else "" # type: ignore[union-attr] # pyright: ignore[reportArgumentType,reportOptionalMemberAccess]
220+
detail = " - ".join(str(exc_arg) for exc_arg in exc.orig.args) if exc.orig.args else "" # type: ignore[union-attr] # pyright: ignore[reportArgumentType,reportOptionalMemberAccess]
221221
for key, (regexes, exception) in _keys_to_regex.items():
222222
for regex in regexes:
223223
if (match := regex.findall(detail)) and match[0]:

pyproject.toml

+1-1
Original file line numberDiff line numberDiff line change
@@ -46,7 +46,7 @@ maintainers = [
4646
name = "advanced_alchemy"
4747
readme = "README.md"
4848
requires-python = ">=3.8"
49-
version = "0.19.1"
49+
version = "0.19.2"
5050

5151
[project.urls]
5252
Changelog = "https://docs.advanced-alchemy.litestar.dev/latest/changelog"

0 commit comments

Comments
 (0)