langfuse.api.unstable.errors

 1# This file was auto-generated by Fern from our API Definition.
 2
 3# isort: skip_file
 4
 5import typing
 6from importlib import import_module
 7
 8if typing.TYPE_CHECKING:
 9    from .types import (
10        PublicApiError,
11        PublicApiErrorCode,
12        PublicApiErrorDetails,
13        PublicApiValidationIssue,
14    )
15    from .errors import (
16        AccessDeniedError,
17        BadRequestError,
18        ConflictError,
19        InternalServerError,
20        MethodNotAllowedError,
21        NotFoundError,
22        TooManyRequestsError,
23        UnauthorizedError,
24        UnprocessableContentError,
25    )
26_dynamic_imports: typing.Dict[str, str] = {
27    "AccessDeniedError": ".errors",
28    "BadRequestError": ".errors",
29    "ConflictError": ".errors",
30    "InternalServerError": ".errors",
31    "MethodNotAllowedError": ".errors",
32    "NotFoundError": ".errors",
33    "PublicApiError": ".types",
34    "PublicApiErrorCode": ".types",
35    "PublicApiErrorDetails": ".types",
36    "PublicApiValidationIssue": ".types",
37    "TooManyRequestsError": ".errors",
38    "UnauthorizedError": ".errors",
39    "UnprocessableContentError": ".errors",
40}
41
42
43def __getattr__(attr_name: str) -> typing.Any:
44    module_name = _dynamic_imports.get(attr_name)
45    if module_name is None:
46        raise AttributeError(
47            f"No {attr_name} found in _dynamic_imports for module name -> {__name__}"
48        )
49    try:
50        module = import_module(module_name, __package__)
51        if module_name == f".{attr_name}":
52            return module
53        else:
54            return getattr(module, attr_name)
55    except ImportError as e:
56        raise ImportError(
57            f"Failed to import {attr_name} from {module_name}: {e}"
58        ) from e
59    except AttributeError as e:
60        raise AttributeError(
61            f"Failed to get {attr_name} from {module_name}: {e}"
62        ) from e
63
64
65def __dir__():
66    lazy_attrs = list(_dynamic_imports.keys())
67    return sorted(lazy_attrs)
68
69
70__all__ = [
71    "AccessDeniedError",
72    "BadRequestError",
73    "ConflictError",
74    "InternalServerError",
75    "MethodNotAllowedError",
76    "NotFoundError",
77    "PublicApiError",
78    "PublicApiErrorCode",
79    "PublicApiErrorDetails",
80    "PublicApiValidationIssue",
81    "TooManyRequestsError",
82    "UnauthorizedError",
83    "UnprocessableContentError",
84]
AccessDeniedError
BadRequestError
ConflictError
InternalServerError
MethodNotAllowedError
NotFoundError
PublicApiError
PublicApiErrorCode
PublicApiErrorDetails
PublicApiValidationIssue
TooManyRequestsError
UnauthorizedError
UnprocessableContentError