"""Code generated by Speakeasy (https://speakeasy.com). DO NOT EDIT."""

from __future__ import annotations
from gram_ai import utils
from gram_ai.types import BaseModel


class ServiceErrorData(BaseModel):
    fault: bool
    r"""Is the error a server-side fault?"""

    id: str
    r"""ID is a unique identifier for this particular occurrence of the problem."""

    message: str
    r"""Message is a human-readable explanation specific to this occurrence of the problem."""

    name: str
    r"""Name is the name of this class of errors."""

    temporary: bool
    r"""Is the error temporary?"""

    timeout: bool
    r"""Is the error a timeout?"""


class ServiceError(Exception):
    r"""unauthorized access"""

    data: ServiceErrorData

    def __init__(self, data: ServiceErrorData):
        self.data = data

    def __str__(self) -> str:
        return utils.marshal_json(self.data, ServiceErrorData)
