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})" )