moto/moto/stepfunctions/exceptions.py
Brian Pandola 68e3d394ab
Stepfunctions improvements (#3427)
* Implement filtering for stepfunctions:ListExecutions

* Add pagination to Step Functions endpoints

Implements a generalized approach to pagination via a decorator method for the
Step Functions endpoints.  Modeled on the real AWS backend behavior, `nextToken`
is a dictionary of pagination information encoded in an opaque string.

With just a bit of metadata hard-coded (`utils.PAGINATION_MODEL`), backend `list`
methods need only be decorated with `@paginate` and ensure that their returned
entities are sorted to get full pagination support without any duplicated code
polluting the model.

Closes #3137
2020-11-01 10:16:41 +00:00

56 lines
1.2 KiB
Python

from __future__ import unicode_literals
import json
class AWSError(Exception):
TYPE = None
STATUS = 400
def __init__(self, message, type=None, status=None):
self.message = message
self.type = type if type is not None else self.TYPE
self.status = status if status is not None else self.STATUS
def response(self):
return (
json.dumps({"__type": self.type, "message": self.message}),
dict(status=self.status),
)
class ExecutionAlreadyExists(AWSError):
TYPE = "ExecutionAlreadyExists"
STATUS = 400
class ExecutionDoesNotExist(AWSError):
TYPE = "ExecutionDoesNotExist"
STATUS = 400
class InvalidArn(AWSError):
TYPE = "InvalidArn"
STATUS = 400
class InvalidName(AWSError):
TYPE = "InvalidName"
STATUS = 400
class InvalidExecutionInput(AWSError):
TYPE = "InvalidExecutionInput"
STATUS = 400
class StateMachineDoesNotExist(AWSError):
TYPE = "StateMachineDoesNotExist"
STATUS = 400
class InvalidToken(AWSError):
TYPE = "InvalidToken"
STATUS = 400
def __init__(self, message="Invalid token"):
super(InvalidToken, self).__init__("Invalid Token: {}".format(message))