aboutsummaryrefslogtreecommitdiffstats
path: root/contrib/python/moto/py3/moto/logs/exceptions.py
blob: c34f462f1665aa25d461e9b88e711f9b83549503 (plain) (blame)
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
from moto.core.exceptions import JsonRESTError


class LogsClientError(JsonRESTError):
    code = 400


class ResourceNotFoundException(LogsClientError):
    def __init__(self, msg=None):
        self.code = 400
        super().__init__(
            "ResourceNotFoundException", msg or "The specified log group does not exist"
        )


class InvalidParameterException(LogsClientError):
    def __init__(self, msg=None, constraint=None, parameter=None, value=None):
        self.code = 400
        if constraint:
            msg = "1 validation error detected: Value '{}' at '{}' failed to satisfy constraint: {}".format(
                value, parameter, constraint
            )
        super().__init__(
            "InvalidParameterException", msg or "A parameter is specified incorrectly."
        )


class ResourceAlreadyExistsException(LogsClientError):
    def __init__(self):
        self.code = 400
        super().__init__(
            "ResourceAlreadyExistsException", "The specified log group already exists"
        )


class LimitExceededException(LogsClientError):
    def __init__(self):
        self.code = 400
        super().__init__("LimitExceededException", "Resource limit exceeded.")