2014-08-27 15:17:06 +00:00
|
|
|
from __future__ import unicode_literals
|
2018-06-01 03:05:50 +00:00
|
|
|
from moto.core.exceptions import RESTError
|
2014-11-15 14:35:52 +00:00
|
|
|
|
|
|
|
|
2014-06-20 21:31:19 +00:00
|
|
|
class MessageNotInflight(Exception):
|
|
|
|
description = "The message referred to is not in flight."
|
|
|
|
status_code = 400
|
|
|
|
|
|
|
|
|
|
|
|
class ReceiptHandleIsInvalid(Exception):
|
|
|
|
description = "The receipt handle provided is not valid."
|
|
|
|
status_code = 400
|
2014-09-28 19:59:14 +00:00
|
|
|
|
|
|
|
|
|
|
|
class MessageAttributesInvalid(Exception):
|
2014-11-15 14:53:45 +00:00
|
|
|
status_code = 400
|
2014-09-28 19:59:14 +00:00
|
|
|
|
2014-11-15 14:53:45 +00:00
|
|
|
def __init__(self, description):
|
|
|
|
self.description = description
|
2017-10-10 19:51:48 +00:00
|
|
|
|
|
|
|
|
2019-10-18 07:04:29 +00:00
|
|
|
class QueueDoesNotExist(RESTError):
|
|
|
|
code = 404
|
|
|
|
|
|
|
|
def __init__(self):
|
|
|
|
super(QueueDoesNotExist, self).__init__(
|
|
|
|
"QueueDoesNotExist", "The specified queue does not exist for this wsdl version.")
|
2018-06-01 03:05:50 +00:00
|
|
|
|
|
|
|
|
|
|
|
class QueueAlreadyExists(RESTError):
|
|
|
|
code = 400
|
|
|
|
|
|
|
|
def __init__(self, message):
|
|
|
|
super(QueueAlreadyExists, self).__init__(
|
|
|
|
"QueueAlreadyExists", message)
|
2019-10-26 20:08:45 +00:00
|
|
|
|
|
|
|
|
|
|
|
class EmptyBatchRequest(RESTError):
|
|
|
|
code = 400
|
|
|
|
|
|
|
|
def __init__(self):
|
|
|
|
super(EmptyBatchRequest, self).__init__(
|
|
|
|
'EmptyBatchRequest',
|
|
|
|
'There should be at least one SendMessageBatchRequestEntry in the request.'
|
|
|
|
)
|
|
|
|
|
|
|
|
|
|
|
|
class InvalidBatchEntryId(RESTError):
|
|
|
|
code = 400
|
|
|
|
|
|
|
|
def __init__(self):
|
|
|
|
super(InvalidBatchEntryId, self).__init__(
|
|
|
|
'InvalidBatchEntryId',
|
|
|
|
'A batch entry id can only contain alphanumeric characters, '
|
|
|
|
'hyphens and underscores. It can be at most 80 letters long.'
|
|
|
|
)
|
|
|
|
|
|
|
|
|
|
|
|
class BatchRequestTooLong(RESTError):
|
|
|
|
code = 400
|
|
|
|
|
|
|
|
def __init__(self, length):
|
|
|
|
super(BatchRequestTooLong, self).__init__(
|
|
|
|
'BatchRequestTooLong',
|
|
|
|
'Batch requests cannot be longer than 262144 bytes. '
|
|
|
|
'You have sent {} bytes.'.format(length)
|
|
|
|
)
|
|
|
|
|
|
|
|
|
|
|
|
class BatchEntryIdsNotDistinct(RESTError):
|
|
|
|
code = 400
|
|
|
|
|
|
|
|
def __init__(self, entry_id):
|
|
|
|
super(BatchEntryIdsNotDistinct, self).__init__(
|
|
|
|
'BatchEntryIdsNotDistinct',
|
|
|
|
'Id {} repeated.'.format(entry_id)
|
|
|
|
)
|
|
|
|
|
|
|
|
|
|
|
|
class TooManyEntriesInBatchRequest(RESTError):
|
|
|
|
code = 400
|
|
|
|
|
|
|
|
def __init__(self, number):
|
|
|
|
super(TooManyEntriesInBatchRequest, self).__init__(
|
|
|
|
'TooManyEntriesInBatchRequest',
|
|
|
|
'Maximum number of entries per request are 10. '
|
|
|
|
'You have sent {}.'.format(number)
|
|
|
|
)
|
2019-10-27 11:13:33 +00:00
|
|
|
|
|
|
|
|
|
|
|
class InvalidAttributeName(RESTError):
|
|
|
|
code = 400
|
|
|
|
|
|
|
|
def __init__(self, attribute_name):
|
|
|
|
super(InvalidAttributeName, self).__init__(
|
|
|
|
'InvalidAttributeName',
|
|
|
|
'Unknown Attribute {}.'.format(attribute_name)
|
|
|
|
)
|