Skip to content

Commit 07b095c

Browse files
committed
Add missing cast for extract_postgres_error
1 parent 5a5931c commit 07b095c

File tree

1 file changed

+2
-2
lines changed

1 file changed

+2
-2
lines changed

psqlextra/error.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
from typing import TYPE_CHECKING, Optional, Type, Union
1+
from typing import TYPE_CHECKING, Optional, Type, Union, cast
22

33
from django import db
44

@@ -38,7 +38,7 @@ def extract_postgres_error(
3838
):
3939
return None
4040

41-
return error.__cause__
41+
return cast(Union["_Psycopg2Error", "_Psycopg3Error"], error.__cause__)
4242

4343

4444
def extract_postgres_error_code(error: db.Error) -> Optional[str]:

0 commit comments

Comments
 (0)