refactor: remove all inline comments from code
This commit is contained in:
@@ -1,64 +1,25 @@
|
||||
"""Custom application exceptions."""
|
||||
|
||||
|
||||
class AppException(Exception):
|
||||
"""Base application exception."""
|
||||
|
||||
def __init__(self, message: str, status_code: int = 500):
|
||||
"""Initialize application exception.
|
||||
|
||||
Args:
|
||||
message: Error message.
|
||||
status_code: HTTP status code.
|
||||
"""
|
||||
self.message = message
|
||||
self.status_code = status_code
|
||||
super().__init__(self.message)
|
||||
|
||||
|
||||
class NotFoundError(AppException):
|
||||
"""Resource not found error."""
|
||||
|
||||
def __init__(self, message: str = "Resource not found"):
|
||||
"""Initialize not found error.
|
||||
|
||||
Args:
|
||||
message: Error message.
|
||||
"""
|
||||
super().__init__(message, status_code=404)
|
||||
|
||||
|
||||
class ValidationError(AppException):
|
||||
"""Validation error."""
|
||||
|
||||
def __init__(self, message: str = "Validation failed"):
|
||||
"""Initialize validation error.
|
||||
|
||||
Args:
|
||||
message: Error message.
|
||||
"""
|
||||
super().__init__(message, status_code=400)
|
||||
|
||||
|
||||
class UnauthorizedError(AppException):
|
||||
"""Authentication required."""
|
||||
|
||||
def __init__(self, message: str = "Unauthorized"):
|
||||
"""Initialize unauthorized error.
|
||||
|
||||
Args:
|
||||
message: Error message.
|
||||
"""
|
||||
super().__init__(message, status_code=401)
|
||||
|
||||
|
||||
class ForbiddenError(AppException):
|
||||
"""Permission denied."""
|
||||
|
||||
def __init__(self, message: str = "Forbidden"):
|
||||
"""Initialize forbidden error.
|
||||
|
||||
Args:
|
||||
message: Error message.
|
||||
"""
|
||||
super().__init__(message, status_code=403)
|
||||
|
||||
Reference in New Issue
Block a user