Skip to content

[FEATURE]: Let DependencyLoader.load_dependency return MaybeSourceContainer #3584

New issue

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

Open
1 task done
JCZuurmond opened this issue Jan 29, 2025 · 0 comments
Open
1 task done
Labels

Comments

@JCZuurmond
Copy link
Member

JCZuurmond commented Jan 29, 2025

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

@JCZuurmond JCZuurmond added needs-triage tech debt chores and design flaws labels Jan 29, 2025
@JCZuurmond JCZuurmond added this to UCX Jan 29, 2025
@github-project-automation github-project-automation bot moved this to Todo in UCX Jan 29, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
Status: Todo
Development

No branches or pull requests

2 participants