watlowlib.errors¶
The typed exception hierarchy and ErrorContext dataclass. Every
public-facing error inherits from WatlowError; protocol-specific
errors carry per-protocol context (Std Bus class/member/instance,
Modbus register address / function code) on error.context. See
Troubleshooting for the common-error table.
Public surface¶
watlowlib.errors ¶
Typed exception hierarchy for :mod:watlowlib.
Every library exception inherits from :class:WatlowError and carries a
structured :class:ErrorContext. See docs/design.md §8.
ErrorContext selector fields are populated per-protocol:
- Std Bus failures fill
cls/member/instance. - Modbus failures fill
register_address/function_code.
Wire-level fields (request / response / elapsed_s) are best-
effort and may be None for failures raised before I/O.
:class:WatlowCapabilityWarning, :class:WatlowCapabilityError, and
:class:WatlowFirmwareError are reserved as part of the planned
capability-gate hierarchy (design §5). They are exported for callers
that want to except on them without pinning a future minor; the
library does not currently emit any of the three. Capability mismatches
on writes (e.g. cool-side gains on a heat-only PM) currently surface as
:class:WatlowConfigurationError.
ErrorContext
dataclass
¶
ErrorContext(
command_name=None,
protocol=None,
port=None,
address=None,
parameter_id=None,
cls=None,
member=None,
instance=None,
register_address=None,
function_code=None,
request=None,
response=None,
elapsed_s=None,
)
Structured context attached to every :class:WatlowError.
Fields are best-effort — missing data is None rather than raising.
WatlowCapabilityError ¶
Bases: WatlowError
Command is not available on this device / firmware / family.
Reserved for the planned capability-gate hierarchy. The library
does not currently raise this — capability mismatches surface as
:class:WatlowConfigurationError today (see commands/loop.py).
Source code in src/watlowlib/errors.py
WatlowCapabilityWarning ¶
Bases: UserWarning
Reserved warning class — not currently emitted.
Planned use is non-strict family-prior mismatches (attempt the command, warn, update availability from the device's response). The library does not currently emit this; the warning class is exported so callers can pre-register filters.
WatlowConfigurationError ¶
Bases: WatlowError
Configuration-level error (bad args, conflicting settings).
Source code in src/watlowlib/errors.py
WatlowConfirmationRequiredError ¶
Bases: WatlowConfigurationError
A PERSISTENT / DANGEROUS command was attempted without confirm=True.
Source code in src/watlowlib/errors.py
WatlowConnectionError ¶
Bases: WatlowTransportError
Could not open / lost the connection to the device.
Source code in src/watlowlib/errors.py
WatlowError ¶
WatlowFirmwareError ¶
Bases: WatlowCapabilityError
Command is outside the supported firmware window.
Reserved alongside :class:WatlowCapabilityError; not currently
emitted by the library.
Source code in src/watlowlib/errors.py
WatlowFrameError ¶
Bases: WatlowProtocolError
Bad CRC, bad length, malformed framing, etc.
Source code in src/watlowlib/errors.py
WatlowModbusError ¶
Bases: WatlowProtocolError
Base class for Modbus-layer errors.
Wraps every anymodbus exception so callers see one error
hierarchy regardless of protocol. __cause__ preserves the
original anymodbus exception for callers that need it.
Source code in src/watlowlib/errors.py
WatlowModbusIllegalDataAddressError ¶
Bases: WatlowModbusError, WatlowProtocolUnsupportedError
Modbus exception 0x02 — register address not allowed.
Maps to :class:Availability.UNSUPPORTED in the session cache.
Source code in src/watlowlib/errors.py
WatlowModbusIllegalDataValueError ¶
Bases: WatlowModbusError
Modbus exception 0x03 — bad argument, not absence.
Does not affect availability (the parameter exists; the write value was simply rejected).
Source code in src/watlowlib/errors.py
WatlowModbusIllegalFunctionError ¶
Bases: WatlowModbusError, WatlowProtocolUnsupportedError
Modbus exception 0x01 — slave does not implement the function.
Maps to :class:Availability.UNSUPPORTED in the session cache.
Inherits :class:WatlowProtocolUnsupportedError so the session's
sticky-unsupported handling treats it like Std Bus 0x81 /
0x83.
Source code in src/watlowlib/errors.py
WatlowModbusSlaveFailureError ¶
Bases: WatlowModbusError
Modbus exception 0x04 — unrecoverable slave-side error.
Does not affect availability — non-response is not a refusal of the parameter (per design §5b table).
Source code in src/watlowlib/errors.py
WatlowModbusTimeoutError ¶
Bases: WatlowModbusError, WatlowTimeoutError
Modbus request timed out at the protocol layer.
Inherits :class:WatlowTimeoutError so callers with existing
timeout-handling code see this as a transport timeout. Does not
affect availability.
Source code in src/watlowlib/errors.py
WatlowNoSuchAttributeError ¶
Bases: WatlowProtocolError
Standard Bus error 0x83 — valid class, invalid member.
Maps to :class:Availability.UNSUPPORTED in the session cache.
Source code in src/watlowlib/errors.py
WatlowNoSuchInstanceError ¶
Bases: WatlowProtocolError
Standard Bus error 0x84 — valid class+member, invalid instance.
The parameter exists but the requested loop / channel does not. Does not affect availability (a different instance may succeed).
Source code in src/watlowlib/errors.py
WatlowNoSuchObjectError ¶
Bases: WatlowProtocolError
Standard Bus error 0x81 — invalid class.
The device does not expose the requested object class. Maps to
:class:Availability.UNSUPPORTED in the session cache.
Source code in src/watlowlib/errors.py
WatlowProtocolError ¶
Bases: WatlowError
Protocol-level error (framing, parsing, unrecognised reply).
Source code in src/watlowlib/errors.py
WatlowProtocolUnsupportedError ¶
Bases: WatlowProtocolError
The active protocol cannot satisfy this command on this device.
Sticky for the session: subsequent attempts at the same command
short-circuit with this error pre-I/O. Set on Std Bus 0x81 /
0x83 and on Modbus IllegalFunction / IllegalDataAddress
per docs/design.md §5b.
Source code in src/watlowlib/errors.py
WatlowSinkDependencyError ¶
Bases: WatlowSinkError
An optional sink extra is not installed.
Raised by sinks behind a [parquet] / [postgres] extra when the
backing dependency (pyarrow, asyncpg) is missing at
:meth:open time. Instantiating the sink succeeds on bare-core
installs; the dependency check is deferred so import-time errors
don't break callers that never reach for the extra.
Source code in src/watlowlib/errors.py
WatlowSinkError ¶
Bases: WatlowError
Base class for :mod:watlowlib.sinks errors.
Source code in src/watlowlib/errors.py
WatlowSinkSchemaError ¶
Bases: WatlowSinkError
The target sink's existing schema does not match what the row carries.
Raised when a sink configured with create_table=False is pointed
at a missing or incompatible backing schema.
Source code in src/watlowlib/errors.py
WatlowSinkWriteError ¶
Bases: WatlowSinkError
A sink-backend write failed (CREATE TABLE, INSERT, file IO, ...).
__cause__ preserves the backend-native exception (sqlite3.Error,
OSError, ...) for callers that want to inspect it.
Source code in src/watlowlib/errors.py
WatlowTimeoutError ¶
Bases: WatlowTransportError
A transport read or write timed out.
Source code in src/watlowlib/errors.py
WatlowTransportError ¶
WatlowValidationError ¶
Bases: WatlowConfigurationError
Request validation failed before I/O (bad instance, bad value).