error-handling-patterns
Use when adding error handling - exception patterns, HTTP codes, domain exceptions
Codex 또는 Claude로 설치 이 Prompt를 복사해 Codex, Claude 또는 다른 어시스턴트에 붙여 넣으면 Skill 페이지를 검토하고 설치를 진행할 수 있습니다.
메뉴
Use when adding error handling - exception patterns, HTTP codes, domain exceptions
Codex 또는 Claude로 설치 이 Prompt를 복사해 Codex, Claude 또는 다른 어시스턴트에 붙여 넣으면 Skill 페이지를 검토하고 설치를 진행할 수 있습니다.
SOC 직업 분류 기준
Master code organization - encapsulation with wrapper methods, file modularity (split >150 lines), one function one responsibility, descriptive naming, minimal comments
Use when starting work - guidelines for asking questions and commit policies
Use when adding logging to features - structured logging with LoggerService categories
Use when exiting plan mode - where to save implementation plans
Apply Martin Fowler's refactoring patterns - extract variables to eliminate repetition, split temporary variables, replace temp with query for cleaner, more maintainable code
Use when writing tests - test structure, mocking patterns, pre-commit checks
| name | error-handling-patterns |
| description | Use when adding error handling - exception patterns, HTTP codes, domain exceptions |
Use this skill when implementing error handling for features or API endpoints.
except - always specify exception typeclass ModelNotFoundError(ValueError):
"""Raised when a requested model is not found."""
pass
class InsufficientMemoryError(RuntimeError):
"""Raised when GPU memory is insufficient for operation."""
pass
Use the correct status code for each situation:
from app.services import logger_service
from app.schemas.responses import ErrorResponse, SuccessResponse
logger = logger_service.get_logger(__name__, category='API')
async def generate_image(config: GenerateConfig, db: Session):
try:
result = await service.generate_image(config, db)
return SuccessResponse(data=result)
except ValueError as error:
logger.error(f"Generation failed: {error}")
raise HTTPException(status_code=400, detail=str(error))
except torch.cuda.OutOfMemoryError:
logger.error("Out of GPU memory")
raise HTTPException(status_code=500, detail="Insufficient GPU memory")
except Exception as error:
logger.exception(f"Unexpected error: {error}")
raise HTTPException(status_code=500, detail="Internal server error")
except:)