We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Current errors lack operational context needed to debug pipeline failures.
BaseComponent._error()
The text was updated successfully, but these errors were encountered:
example implementation for context :
from typing import Dict, Any, Type from stimulus.exceptions import StimulusError class BaseComponent: """Base class providing error context handling""" def __init__(self, config: Dict[str, Any]): self.config = config def _component_context(self) -> Dict[str, Any]: return { "component": self.__class__.__name__, "config_keys": list(self.config.keys()), "phase": getattr(self, "current_phase", "initialization") } def error(self, exc_type: Type[StimulusError], msg: str, **ctx) -> StimulusError: return exc_type(msg).add_context( **self._component_context(), **ctx ) # Usage in data handler class ImageHandler(BaseComponent): def load(self, path: str): if not path.endswith(".png"): raise self.error( StimulusError, "Unsupported image format", allowed_formats=[".png", ".jpg"], requested_file=path )
Sorry, something went wrong.
No branches or pull requests
Is your change request related to a problem? Please describe.
Current errors lack operational context needed to debug pipeline failures.
Describe the solution you'd like
BaseComponent._error()
helper methodThe text was updated successfully, but these errors were encountered: