Files
infospace-bench/src/infospace_bench/errors.py
2026-05-14 11:32:25 +02:00

26 lines
607 B
Python

from __future__ import annotations
from dataclasses import dataclass, field
from typing import Any
@dataclass
class InfospaceError(Exception):
"""Structured application error suitable for CLI and API surfaces."""
code: str
message: str
detail: dict[str, Any] = field(default_factory=dict)
def __post_init__(self) -> None:
super().__init__(self.message)
def to_dict(self) -> dict[str, Any]:
return {
"error": {
"code": self.code,
"message": self.message,
"detail": self.detail,
}
}