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 error handling uses generic exceptions without context, making debugging difficult in pipeline executions.
stimulus/exceptions.py
StimulusError
The text was updated successfully, but these errors were encountered:
example implementation for context :
from typing import Optional, Dict, Any class StimulusError(Exception): """Base exception with context-aware formatting""" def __init__(self, msg: str, context: Optional[Dict[str, Any]] = None): super().__init__(msg) self.context = context or {} def add_context(self, **additional_context: Any) -> "StimulusError": """Chainable context builder""" self.context.update(additional_context) return self def __str__(self) -> str: base_msg = super().__str__() if self.context: ctx_str = " | ".join(f"{k}={v}" for k,v in self.context.items()) return f"{base_msg} [{ctx_str}]" return base_msg class LoaderConfigError(StimulusError): """Raised when loader configuration is invalid""" # Usage in loader class class DataLoader: def __init__(self, config: dict): if "columns" not in config: raise LoaderConfigError("Missing columns definition").add_context( config_keys=list(config.keys()), loader_type=self.__class__.__name__ )
Sorry, something went wrong.
No branches or pull requests
Is your change request related to a problem? Please describe.
Current error handling uses generic exceptions without context, making debugging difficult in pipeline executions.
Describe the solution you'd like
stimulus/exceptions.py
with baseStimulusError
and component-specific exceptionsThe text was updated successfully, but these errors were encountered: