Skip to content

Commit 429d76d

Browse files
committed
Fixes 3
1 parent 217508b commit 429d76d

File tree

1 file changed

+2
-1
lines changed

1 file changed

+2
-1
lines changed

lib/callbacks.py

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -24,7 +24,8 @@ def raise_http_exception(request: Request) -> Callable[[Exception | str], Awaita
2424
"""Callback to raise an HTTPException with a specific status code."""
2525

2626
async def _raise_http_exception(error: Exception | str) -> None:
27+
message = f"{type(error).__name__}: {error}" if isinstance(error, Exception) else str(error)
2728
code = error.status_code if isinstance(error, HTTPException) else 502
28-
raise StreamTerminated(f"{code}: {str(error)}") from error
29+
raise StreamTerminated(f"{code} - {message}") from error
2930

3031
return _raise_http_exception

0 commit comments

Comments
 (0)