Spaces:
Runtime error
Runtime error
Download app/errors.py from suvradeepp/reno-scheduling-engine: direct link, hf CLI and curl.
- Browser
- Download file 1.02 kB
-
https://huggingface.co/spaces/suvradeepp/reno-scheduling-engine/resolve/main/app/errors.py
- Command line
-
hf download hf://spaces/suvradeepp/reno-scheduling-engine/app/errors.py
-
curl -L -o errors.py https://huggingface.co/spaces/suvradeepp/reno-scheduling-engine/resolve/main/app/errors.py
1.02 kB
| """Shared domain errors mapped to HTTP responses in the API layer.""" | |
| class DomainError(Exception): | |
| """Base for errors that map to a specific HTTP status.""" | |
| class BaselineExistsError(DomainError): | |
| def __init__(self, existing_version_id: int): | |
| self.existing_version_id = existing_version_id | |
| super().__init__(f"A baseline already exists (version {existing_version_id})") | |
| class NotFoundError(DomainError): | |
| def __init__(self, what: str): | |
| self.what = what | |
| super().__init__(f"{what} not found") | |
| class MissingDurationError(DomainError): | |
| """A WORKING activity lacks effort_days, or a WALL activity lacks lead_time_days.""" | |
| def __init__(self, activity_id: int, clock: str): | |
| self.activity_id = activity_id | |
| self.clock = clock | |
| field = "effort_days" if clock == "WORKING" else "lead_time_days" | |
| super().__init__( | |
| f"Activity {activity_id} ({clock}) is missing {field}; cannot schedule it." | |
| ) | |