Tech Debt - Remove duplicate AWSError classes

This commit is contained in:
Bert Blommers 2020-11-05 11:20:18 +00:00
commit 032b9c4008
10 changed files with 30 additions and 112 deletions

View file

@ -2,6 +2,7 @@ from __future__ import unicode_literals
from werkzeug.exceptions import HTTPException
from jinja2 import DictLoader, Environment
import json
SINGLE_ERROR_RESPONSE = """<?xml version="1.0" encoding="UTF-8"?>
@ -109,6 +110,22 @@ class AuthFailureError(RESTError):
)
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 InvalidNextTokenException(JsonRESTError):
"""For AWS Config resource listing. This will be used by many different resource types, and so it is in moto.core."""