HTTPExceptions #2

Open
opened 2026-05-20 13:52:18 +00:00 by chris · 0 comments
Owner

Create specific HTTPExceptions within relevant modules. e.g.

class UserNotFoundException(HTTPException):
	def __init__(self, user_id: Optional[int] = None) -> None:
		detail = "User not found" if user_id is None else f"User with ID '{user_id}' was not found."
		super().__init__(
			status_code=status.HTTP_404_NOT_FOUND,
			detail=detail,
		)

Create specific HTTPExceptions within relevant modules. e.g. ``` class UserNotFoundException(HTTPException): def __init__(self, user_id: Optional[int] = None) -> None: detail = "User not found" if user_id is None else f"User with ID '{user_id}' was not found." super().__init__( status_code=status.HTTP_404_NOT_FOUND, detail=detail, ) ```
Sign in to join this conversation.
No milestone
No project
No assignees
1 participant
Notifications
Due date
The due date is invalid or out of range. Please use the format "yyyy-mm-dd".

No due date set.

Dependencies

No dependencies set.

Reference: sr2/cloud-api#2
No description provided.