File: exceptions.py

package info (click to toggle)
python-moto 5.1.18-3
  • links: PTS, VCS
  • area: main
  • in suites: forky, sid
  • size: 116,520 kB
  • sloc: python: 636,725; javascript: 181; makefile: 39; sh: 3
file content (135 lines) | stat: -rw-r--r-- 3,249 bytes parent folder | download | duplicates (2)
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
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
from moto.core.exceptions import JsonRESTError


class APIGatewayV2Error(JsonRESTError):
    pass


class ApiNotFound(APIGatewayV2Error):
    code = 404

    def __init__(self, api_id: str):
        super().__init__(
            "NotFoundException", f"Invalid API identifier specified {api_id}"
        )


class AuthorizerNotFound(APIGatewayV2Error):
    code = 404

    def __init__(self, authorizer_id: str):
        super().__init__(
            "NotFoundException",
            f"Invalid Authorizer identifier specified {authorizer_id}",
        )


class ModelNotFound(APIGatewayV2Error):
    code = 404

    def __init__(self, model_id: str):
        super().__init__(
            "NotFoundException", f"Invalid Model identifier specified {model_id}"
        )


class RouteResponseNotFound(APIGatewayV2Error):
    code = 404

    def __init__(self, rr_id: str):
        super().__init__(
            "NotFoundException", f"Invalid RouteResponse identifier specified {rr_id}"
        )


class BadRequestException(APIGatewayV2Error):
    code = 400

    def __init__(self, message: str):
        super().__init__("BadRequestException", message)


class IntegrationNotFound(APIGatewayV2Error):
    code = 404

    def __init__(self, integration_id: str):
        super().__init__(
            "NotFoundException",
            f"Invalid Integration identifier specified {integration_id}",
        )


class IntegrationResponseNotFound(APIGatewayV2Error):
    code = 404

    def __init__(self, int_res_id: str):
        super().__init__(
            "NotFoundException",
            f"Invalid IntegrationResponse identifier specified {int_res_id}",
        )


class RouteNotFound(APIGatewayV2Error):
    code = 404

    def __init__(self, route_id: str):
        super().__init__(
            "NotFoundException", f"Invalid Route identifier specified {route_id}"
        )


class VpcLinkNotFound(APIGatewayV2Error):
    code = 404

    def __init__(self, vpc_link_id: str):
        super().__init__(
            "NotFoundException", f"Invalid VpcLink identifier specified {vpc_link_id}"
        )


class UnknownProtocol(APIGatewayV2Error):
    def __init__(self) -> None:
        super().__init__(
            "BadRequestException",
            "Invalid protocol specified. Must be one of [HTTP, WEBSOCKET]",
        )


class DomainNameNotFound(APIGatewayV2Error):
    code = 404

    def __init__(self) -> None:
        super().__init__(
            "NotFoundException",
            "The domain name resource specified in the request was not found.",
        )


class DomainNameAlreadyExists(APIGatewayV2Error):
    code = 409

    def __init__(self) -> None:
        super().__init__(
            "ConflictException",
            "The domain name resource already exists.",
        )


class ApiMappingNotFound(APIGatewayV2Error):
    code = 404

    def __init__(self) -> None:
        super().__init__(
            "NotFoundException",
            "The api mapping resource specified in the request was not found.",
        )


class StageNotFound(APIGatewayV2Error):
    code = 404

    def __init__(self) -> None:
        super().__init__(
            "NotFoundException",
            "Invalid stage identifier specified",
        )