Skip to content

Commit 4a88519

Browse files
committed
fix(fastapi): make valid signature for error handlers
1 parent 9c0fdb8 commit 4a88519

File tree

3 files changed

+9
-9
lines changed

3 files changed

+9
-9
lines changed

src/tgdb/presentation/fastapi/common/error_handling.py

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -23,7 +23,7 @@ def add_error_handling(app: FastAPI) -> None:
2323

2424
def add_common_error_handling(app: FastAPI) -> None:
2525
@app.exception_handler(NoRelationError)
26-
def _(_: object) -> Response:
26+
def _(_: object, __: object) -> Response:
2727
schema = NoRelationSchema()
2828

2929
return JSONResponse(
@@ -32,7 +32,7 @@ def _(_: object) -> Response:
3232
)
3333

3434
@app.exception_handler(NotUniqueRelationNumberError)
35-
def _(_: object) -> Response:
35+
def _(_: object, __: object) -> Response:
3636
schema = NotUniqueRelationNumberSchema()
3737

3838
return JSONResponse(
@@ -41,7 +41,7 @@ def _(_: object) -> Response:
4141
)
4242

4343
@app.exception_handler(OversizedRelationSchemaError)
44-
def _(error: OversizedRelationSchemaError) -> Response:
44+
def _(_: object, error: OversizedRelationSchemaError) -> Response:
4545
schema = OversizedRelationSchemaSchema.of(error)
4646

4747
return JSONResponse(

src/tgdb/presentation/fastapi/horizon/error_handling.py

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -18,7 +18,7 @@
1818

1919
def add_horizon_error_handling(app: FastAPI) -> None:
2020
@app.exception_handler(ConflictError)
21-
def _(conflict: ConflictError) -> Response:
21+
def _(_: object, conflict: ConflictError) -> Response:
2222
schema = TransactionConflictSchema.of(conflict)
2323

2424
return JSONResponse(
@@ -27,22 +27,22 @@ def _(conflict: ConflictError) -> Response:
2727
)
2828

2929
@app.exception_handler(NoTransactionError)
30-
def _(_: object) -> Response:
30+
def _(_: object, __: object) -> Response:
3131
return JSONResponse(
3232
NoTransactionSchema().model_dump(mode="json", by_alias=True),
3333
status_code=status.HTTP_404_NOT_FOUND,
3434
)
3535

3636
@app.exception_handler(InvalidTransactionStateError)
37-
def _(_: object) -> Response:
37+
def _(_: object, __: object) -> Response:
3838
schema = InvalidTransactionStateSchema()
3939
return JSONResponse(
4040
schema.model_dump(mode="json", by_alias=True),
4141
status_code=status.HTTP_404_NOT_FOUND,
4242
)
4343

4444
@app.exception_handler(NonSerializableWriteTransactionError)
45-
def _(_: object) -> Response:
45+
def _(_: object, __: object) -> Response:
4646
schema = InvalidTransactionStateSchema()
4747
return JSONResponse(
4848
schema.model_dump(mode="json", by_alias=True),

src/tgdb/presentation/fastapi/relation/routes/view_tuples.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -34,7 +34,7 @@ def of(cls, tuples: Iterable[Tuple]) -> "ViewedTuplesSchema":
3434

3535

3636
@view_tuples_router.post(
37-
"/transactions/{xid}/viewed-tuples",
37+
"/relations/{relation_number}/viewed-tuples",
3838
status_code=status.HTTP_200_OK,
3939
responses={
4040
status.HTTP_200_OK: {"model": ViewedTuplesSchema},
@@ -51,7 +51,7 @@ def of(cls, tuples: Iterable[Tuple]) -> "ViewedTuplesSchema":
5151
async def _(
5252
view_tuples: FromDishka[ViewTuples],
5353
xid: XID,
54-
relation_number: Annotated[PositiveInt, Query(alias="relationNumber")],
54+
relation_number: PositiveInt,
5555
attribute_number: Annotated[PositiveInt, Query(alias="attributeNumber")],
5656
attribute_scalar: Annotated[Scalar, Query(alias="attributeScalar")],
5757
) -> Response:

0 commit comments

Comments
 (0)