Update format of S3 client errors

To match
http://docs.aws.amazon.com/AmazonS3/latest/API/ErrorResponses.html#RESTErrorResponses
which documents that it should be at the top level rather than nested
under `Errors`.
This commit is contained in:
Jesse Szwedko 2016-07-08 19:32:34 +00:00
commit ef10df0636
3 changed files with 31 additions and 3 deletions

View file

@ -2,17 +2,20 @@ from __future__ import unicode_literals
from moto.core.exceptions import RESTError
ERROR_WITH_BUCKET_NAME = """{% extends 'error' %}
ERROR_WITH_BUCKET_NAME = """{% extends 'single_error' %}
{% block extra %}<BucketName>{{ bucket }}</BucketName>{% endblock %}
"""
ERROR_WITH_KEY_NAME = """{% extends 'error' %}
ERROR_WITH_KEY_NAME = """{% extends 'single_error' %}
{% block extra %}<KeyName>{{ key_name }}</KeyName>{% endblock %}
"""
class S3ClientError(RESTError):
pass
def __init__(self, *args, **kwargs):
kwargs.setdefault('template', 'single_error')
self.templates['bucket_error'] = ERROR_WITH_BUCKET_NAME
super(S3ClientError, self).__init__(*args, **kwargs)
class BucketError(S3ClientError):