moto/moto/logs/exceptions.py

41 lines
1.2 KiB
Python
Raw Normal View History

2018-01-14 14:35:53 +09:00
from __future__ import unicode_literals
from moto.core.exceptions import JsonRESTError
class LogsClientError(JsonRESTError):
code = 400
class ResourceNotFoundException(LogsClientError):
def __init__(self, msg=None):
2018-01-14 14:35:53 +09:00
self.code = 400
super().__init__(
"ResourceNotFoundException", msg or "The specified log group does not exist"
2018-01-14 14:35:53 +09:00
)
class InvalidParameterException(LogsClientError):
def __init__(self, msg=None, constraint=None, parameter=None, value=None):
2018-01-14 14:35:53 +09:00
self.code = 400
if constraint:
msg = "1 validation error detected: Value '{}' at '{}' failed to satisfy constraint: {}".format(
value, parameter, constraint
)
super().__init__(
2019-10-31 08:44:26 -07:00
"InvalidParameterException", msg or "A parameter is specified incorrectly."
2018-01-14 14:35:53 +09:00
)
class ResourceAlreadyExistsException(LogsClientError):
def __init__(self):
self.code = 400
super().__init__(
2019-10-31 08:44:26 -07:00
"ResourceAlreadyExistsException", "The specified log group already exists"
2018-01-14 14:35:53 +09:00
)
class LimitExceededException(LogsClientError):
def __init__(self):
self.code = 400
super().__init__("LimitExceededException", "Resource limit exceeded.")