Open
Description
Is there an existing issue for this?
- I have searched the existing issues
Problem statement
Let DependencyLoader.load_dependency
return MaybeSourceContainer
similarly to the other Maybe
objects:
class MaybeSourceContainer:
"""A source container or failures while loading the source containers."""
source_container: SourceContainer | None = None
"""The source container if successfully loaded."""
problems: list[DependencyProblem] = dataclassess.field(default_factory=list)
"""The problems while loading the dependency into a source container unsuccesfully."""
def __post_init__(self):
if not self.source_container and not self.problems:
raise ValueError(f"Source container OR problems should be given: {self}.")
if self.source_container and self.problems
raise ValueError(f"Source container OR problems should be given: {self}.")
Motivation
Localizes the surfacing and handling errors close to where the sources are loaded so that the problems can be reused where applicable.
Proposed Solution
See above
Additional Context
No response
Metadata
Metadata
Assignees
Labels
Type
Projects
Status
Todo