-
Notifications
You must be signed in to change notification settings - Fork 6
Expand file tree
/
Copy patherrorresponse.py
More file actions
36 lines (28 loc) · 1.23 KB
/
Copy patherrorresponse.py
File metadata and controls
36 lines (28 loc) · 1.23 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
"""Code generated by Speakeasy (https://speakeasy.com). DO NOT EDIT."""
from __future__ import annotations
from dataclasses import dataclass, field
import httpx
from pipeshub_sdk.errors import PipeshubError
from pipeshub_sdk.models import errorresponse as models_errorresponse
from pipeshub_sdk.types import BaseModel
from typing import Optional
class ErrorResponseData(BaseModel):
error: models_errorresponse.ErrorResponseError
@dataclass(unsafe_hash=True)
class ErrorResponse(PipeshubError):
r"""Standard error envelope returned by all errors routed through `ErrorMiddleware`.
Applies to all `BaseError` subclasses including `HttpError`, `ValidationError`, and others.
The `code` field is a machine-readable string identifying the error type (e.g.
`HTTP_UNAUTHORIZED`, `HTTP_NOT_FOUND`, `VALIDATION_ERROR`, `INTERNAL_ERROR`).
"""
data: ErrorResponseData = field(hash=False)
def __init__(
self,
data: ErrorResponseData,
raw_response: httpx.Response,
body: Optional[str] = None,
):
fallback = body or raw_response.text
message = str(data.error.message) or fallback
super().__init__(message, raw_response, body)
object.__setattr__(self, "data", data)