Return the HTTP status code for this error. Only auth-related codes (AUTH_REQUIRED, AUTH_EXPIRED, ACCESS_DENIED) return non-200. All other application errors return HTTP 200 so that the protocol is consistent with streaming APIs and proxies/monitoring do not mi
(self)
| 126 | self.retry = retry |
| 127 | |
| 128 | def get_http_status(self) -> int: |
| 129 | """Return the HTTP status code for this error. |
| 130 | |
| 131 | Only auth-related codes (AUTH_REQUIRED, AUTH_EXPIRED, ACCESS_DENIED) |
| 132 | return non-200. All other application errors return HTTP 200 so that |
| 133 | the protocol is consistent with streaming APIs and proxies/monitoring |
| 134 | do not misinterpret business errors as infrastructure failures. |
| 135 | """ |
| 136 | return ERROR_CODE_HTTP_STATUS.get(self.code, 200) |
| 137 | |
| 138 | def to_dict(self, include_detail: bool = False) -> dict: |
| 139 | """Serialise to the ``error`` object in the JSON response envelope.""" |