...
CI / lint (push) Failing after 20s
CI / test (3.11) (push) Skipped
CI / test (3.12) (push) Skipped
CI / test (3.13) (push) Skipped

This commit is contained in:
2026-07-03 17:44:56 +02:00
parent b038cd5348
commit ff95d278ec
2 changed files with 21 additions and 19 deletions
+11 -19
View File
@@ -12,15 +12,23 @@ logger = setup_logger("aareDAQ")
class AareException(Exception):
"""Root of the aare exception hierarchy."""
def __init__(self, message: str, *args, critical: bool = False, **kwargs):
super().__init__(message, *args, **kwargs)
self.message=message
def __init__(self, *args, critical: bool = False, **kwargs):
super().__init__( *args, **kwargs)
self.critical = critical
class AutomationError(AareException):
"""Errors that happen during a DAQ operation; route through automation flows."""
_DEFAULT_MSG: str = "Generic Automation Error"
def __init__(self, message: str | None = None, critical: bool = False, **kwargs):
self.message = message or self.__class__._DEFAULT_MSG
super().__init__(self.message, **kwargs)
self.critical = critical
def __str__(self) -> str:
return self.message
class AareUserError(AareException):
"""Bad input / mode misuse; routes through the input-correction flow."""
@@ -74,19 +82,11 @@ class TransformationInvalidException(AutomationError):
):
super().__init__(message, critical=critical)
def __str__(self) -> str:
return self.message
class StateTransitionFailed(BeamlineStateException):
def __init__(
self, message: str = "Beamline state transition failed", *, critical: bool=True
):
super().__init__(message, critical=critical)
self.message = message
def __str__(self) -> str:
return self.message
class MaintenanceStateException(BeamlineStateException):
@@ -95,19 +95,11 @@ class MaintenanceStateException(BeamlineStateException):
):
super().__init__(message, critical=critical)
def __str__(self) -> str:
return self.message
class DataCollectionException(AutomationError):
"""Group parent for data-collection-time exceptions; also raisable directly."""
def __init__(self, message: str = "Data collection failed", *, critical: bool | None = None):
super().__init__(message, critical=critical)
self.message = message
def __str__(self) -> str:
return self.message
class RasterScanException(DataCollectionException):
+10
View File
@@ -0,0 +1,10 @@
from typing import Annotated, TypeAliasType
from pydantic import WithJsonSchema
Jsonable = TypeAliasType(
"Jsonable", int | float | str | bool | None | list["Jsonable"] | dict[str, "Jsonable"]
)
JsonableDict = TypeAliasType(
"JsonableDict", Annotated[dict[str, Jsonable], WithJsonSchema({"type": "object"})]
)