Skip to content

Exceptions

Custom exceptions raised by the library.

BSBLANError

bsblan.BSBLANError

BSBLANError(message: str | None = None)

Bases: Exception

Generic BSBLAN exception.

Initialize a new instance of the BSBLANError class.

Parameters:

Name Type Description Default
message str | None

Optional custom error message.

None
Source code in src/bsblan/exceptions.py
def __init__(self, message: str | None = None) -> None:
    """Initialize a new instance of the BSBLANError class.

    Args:
        message: Optional custom error message.

    """
    if message is not None:
        self.message = message
    super().__init__(self.message)

BSBLANConnectionError

bsblan.BSBLANConnectionError

BSBLANConnectionError(message: str | None = None)

Bases: BSBLANError

BSBLAN connection exception.

Initialize a new instance of the BSBLANConnectionError class.

Parameters:

Name Type Description Default
message str | None

Optional error message.

None
Source code in src/bsblan/exceptions.py
def __init__(self, message: str | None = None) -> None:
    """Initialize a new instance of the BSBLANConnectionError class.

    Args:
        message: Optional error message.

    """
    super().__init__(message)

BSBLANAuthError

bsblan.BSBLANAuthError

BSBLANAuthError(message: str | None = None)

Bases: BSBLANError

Raised when authentication fails.

Source code in src/bsblan/exceptions.py
def __init__(self, message: str | None = None) -> None:
    """Initialize a new instance of the BSBLANError class.

    Args:
        message: Optional custom error message.

    """
    if message is not None:
        self.message = message
    super().__init__(self.message)

BSBLANUnsupportedFeatureError

bsblan.BSBLANUnsupportedFeatureError

BSBLANUnsupportedFeatureError(message: str | None = None)

Bases: BSBLANError

A feature is unavailable in the current context; permanence is not implied.

Source code in src/bsblan/exceptions.py
def __init__(self, message: str | None = None) -> None:
    """Initialize a new instance of the BSBLANError class.

    Args:
        message: Optional custom error message.

    """
    if message is not None:
        self.message = message
    super().__init__(self.message)

BSBLANMalformedResponseError

bsblan.BSBLANMalformedResponseError

BSBLANMalformedResponseError(message: str | None = None)

Bases: BSBLANError

A response cannot be decoded or parsed; its retryability is unknown.

Source code in src/bsblan/exceptions.py
def __init__(self, message: str | None = None) -> None:
    """Initialize a new instance of the BSBLANError class.

    Args:
        message: Optional custom error message.

    """
    if message is not None:
        self.message = message
    super().__init__(self.message)

BSBLANScheduleMappingError

bsblan.BSBLANScheduleMappingError

BSBLANScheduleMappingError(
    kind: str, circuit: int | None, reason: str
)

Bases: BSBLANError

A configured mapping is missing or invalid for a schedule operation.

Retain the schedule group, circuit, and local failure reason.

Source code in src/bsblan/exceptions.py
def __init__(self, kind: str, circuit: int | None, reason: str) -> None:
    """Retain the schedule group, circuit, and local failure reason."""
    self.kind = kind
    self.circuit = circuit
    self.reason = reason
    super().__init__(f"{kind} circuit {circuit}: {reason}")

BSBLANScheduleProbeError

bsblan.BSBLANScheduleProbeError

BSBLANScheduleProbeError(
    kind: str, circuit: int | None, reason: str
)

Bases: BSBLANError

Schedule compatibility is inconclusive; retry rather than repair mappings.

Retain group context without classifying this as a mapping failure.

Source code in src/bsblan/exceptions.py
def __init__(self, kind: str, circuit: int | None, reason: str) -> None:
    """Retain group context without classifying this as a mapping failure."""
    self.kind = kind
    self.circuit = circuit
    self.reason = reason
    super().__init__(f"{kind} circuit {circuit}: {reason}; retry discovery")

An automatic compatibility probe was inconclusive. Retry discovery rather than opening a wrong-mapping repair. Connection, authentication and malformed-response errors continue to propagate as their existing exception types.

BSBLANScheduleWriteError

bsblan.BSBLANScheduleWriteError

BSBLANScheduleWriteError(
    *,
    kind: str,
    circuit: int | None,
    acknowledged_days: tuple[Weekday, ...],
    failed_day: Weekday,
    parameter_id: str,
    unattempted_days: tuple[Weekday, ...],
    outcome: Literal["rejected", "unknown"]
)

Bases: BSBLANError

A sequential write stopped; the failed day may have an uncertain outcome.

Keep partial progress separate from acknowledgement or readback proof.

Source code in src/bsblan/exceptions.py
def __init__(  # noqa: PLR0913
    self,
    *,
    kind: str,
    circuit: int | None,
    acknowledged_days: tuple[Weekday, ...],
    failed_day: Weekday,
    parameter_id: str,
    unattempted_days: tuple[Weekday, ...],
    outcome: Literal["rejected", "unknown"],
) -> None:
    """Keep partial progress separate from acknowledgement or readback proof."""
    self.kind = kind
    self.circuit = circuit
    self.acknowledged_days = acknowledged_days
    self.failed_day = failed_day
    self.parameter_id = parameter_id
    self.unattempted_days = unattempted_days
    self.outcome = outcome
    super().__init__(
        f"{kind} schedule circuit {circuit}: {failed_day} parameter "
        f"{parameter_id} outcome {outcome}; acknowledged {acknowledged_days}; "
        f"unattempted {unattempted_days}"
    )

A partial/uncertain write is not rolled back. Inspect acknowledged, failed and unattempted days, then perform explicit readback; see the migration guide.