Skip to content

errors

errors

Errors raised by the script analyzer.

MissingExtraError

MissingExtraError(extra: str, package: str)

Bases: ImportError

An optional extra the script analyzer needs is not installed.

Parameters:

Name Type Description Default
extra str

Name of the pyproject extra that provides the dependency.

required
package str

Name of the missing import.

required
Source code in src/crew_dcs/integrations/agents/script_analyzer/errors.py
26
27
28
29
30
31
32
33
def __init__(self, extra: str, package: str):
    self.extra = extra
    self.package = package
    super().__init__(
        f"{package} is not installed; the script analyzer needs the optional "
        f"'{extra}' extra: install 'crew-dcs[{extra}]' from the private index "
        f'(see https://domolibrary.datacrew.space/getting-started/install/, "Optional extras")'
    )

ScriptAnalysisError

ScriptAnalysisError(
    message: str | None = None,
    exception: Exception | None = None,
    entity_id: str | None = None,
    entity_name: str | None = None,
    function_name: str | None = None,
    parent_class: str | None = None,
    status: int | None = None,
    domo_instance: str | None = None,
    is_warning: bool = False,
    additional_context: dict[str, Any] | None = None,
)

Bases: DomoError

The script analyzer graph failed while analysing a script.

Raised with the original exception chained as __cause__, so a failure in any graph node reaches the caller instead of being replaced by a different result.

Source code in src/crew_dcs/base/exceptions.py
 76
 77
 78
 79
 80
 81
 82
 83
 84
 85
 86
 87
 88
 89
 90
 91
 92
 93
 94
 95
 96
 97
 98
 99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
def __init__(
    self,
    message: str | None = None,
    exception: Exception | None = None,
    entity_id: str | None = None,
    entity_name: str | None = None,
    function_name: str | None = None,
    parent_class: str | None = None,
    status: int | None = None,
    domo_instance: str | None = None,
    is_warning: bool = False,
    additional_context: dict[str, Any] | None = None,
):
    self.message = message
    self.exception = exception
    self.entity_id = entity_id
    self.entity_name = entity_name
    self.function_name = function_name
    self.parent_class = parent_class
    self.status = status
    self.domo_instance = domo_instance
    self.is_warning = is_warning
    self.additional_context = additional_context or {}

    if not self.message and not self.exception:
        raise ValueError("Either 'message' or 'exception' must be provided.")

    # Use exception chaining if we have an original exception
    if self.exception:
        # This preserves the full traceback chain
        default_msg = self._generate_default_message
        super().__init__(
            f"{default_msg} (caused by: {type(self.exception).__name__}: {self.exception})"
        )
        # Explicitly set the cause for proper exception chaining
        self.__cause__ = self.exception
    else:
        super().__init__(self._generate_default_message)