Initial implementation
This commit is contained in:
parent
6fd1ff7581
commit
916a895a85
31 changed files with 1461 additions and 21 deletions
25
src/infospace_bench/errors.py
Normal file
25
src/infospace_bench/errors.py
Normal file
|
|
@ -0,0 +1,25 @@
|
|||
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,
|
||||
}
|
||||
}
|
||||
Loading…
Add table
Add a link
Reference in a new issue