Decorator for wrapping C API calls
(operation_name: str)
| 225 | # === Exception handling decorators for special scenarios === |
| 226 | |
| 227 | def handle_c_api_errors(operation_name: str): |
| 228 | """Decorator for wrapping C API calls""" |
| 229 | def decorator(func): |
| 230 | def wrapper(*args, **kwargs): |
| 231 | try: |
| 232 | return func(*args, **kwargs) |
| 233 | except Exception as e: |
| 234 | if not isinstance(e, InspireFaceError): |
| 235 | # Wrap non-InspireFace exceptions as ProcessingError |
| 236 | raise ProcessingError( |
| 237 | f"{operation_name}: {str(e)}", |
| 238 | context={'original_exception': type(e).__name__} |
| 239 | ) from e |
| 240 | raise |
| 241 | return wrapper |
| 242 | return decorator |
nothing calls this directly
no outgoing calls
no test coverage detected