Model/infrastructure/hubspot/errors.py
Daniel Roth 8fd808ffd9 HubSpot deal-contacts transport lives under infrastructure like the other API clients 🟪
Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
2026-07-06 14:01:47 +00:00

25 lines
865 B
Python

from typing import Optional
class HubspotRequestError(Exception):
"""A HubSpot API failure, scrubbed of the response body.
HubSpot validation errors echo submitted property values back in the
body, so carrying (or exception-chaining) the SDK error would leak the
submitted PII into tracebacks and logs. Only non-PII diagnostics are
kept: status code, HubSpot error category and correlation id.
"""
def __init__(
self,
status_code: Optional[int],
category: Optional[str],
correlation_id: Optional[str],
) -> None:
self.status_code = status_code
self.category = category
self.correlation_id = correlation_id
super().__init__(
f"HubSpot request failed (status={status_code}, "
f"category={category}, correlation_id={correlation_id})"
)