Refactor Forecast to also use shared AWSError class
This commit is contained in:
parent
1edb1e2e7e
commit
3b6162de67
@ -1,22 +1,6 @@
|
|||||||
from __future__ import unicode_literals
|
from __future__ import unicode_literals
|
||||||
|
|
||||||
import json
|
from moto.core.exceptions import AWSError
|
||||||
|
|
||||||
|
|
||||||
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 InvalidInputException(AWSError):
|
class InvalidInputException(AWSError):
|
||||||
|
Loading…
Reference in New Issue
Block a user