Skip to content

Commit

Permalink
Fix
Browse files Browse the repository at this point in the history
  • Loading branch information
jogo committed Dec 19, 2023
1 parent 22cf831 commit 58a4e6a
Show file tree
Hide file tree
Showing 5 changed files with 1 addition and 14 deletions.
2 changes: 1 addition & 1 deletion moto/core/exceptions.py
Original file line number Diff line number Diff line change
Expand Up @@ -63,7 +63,7 @@ def __init__(
self.error_type = error_type
self.message = message

if template in self.templates.keys():
if template in self.env.list_templates():
self.description: str = self.__class__.env.get_template(template).render(
error_type=error_type,
message=message,
Expand Down
1 change: 0 additions & 1 deletion moto/elasticbeanstalk/exceptions.py
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,6 @@ class ElasticBeanstalkException(RESTError):

def __init__(self, code: str, message: str, **kwargs: Any):
kwargs.setdefault("template", "ecerror")
self.templates["ecerror"] = EXCEPTION_RESPONSE
super().__init__(code, message)


Expand Down
10 changes: 0 additions & 10 deletions moto/s3/exceptions.py
Original file line number Diff line number Diff line change
Expand Up @@ -54,7 +54,6 @@ class S3ClientError(RESTError):

def __init__(self, *args: Any, **kwargs: Any):
kwargs.setdefault("template", "single_error")
self.templates["bucket_error"] = ERROR_WITH_BUCKET_NAME
super().__init__(*args, **kwargs)


Expand All @@ -65,7 +64,6 @@ def __init__(self, message: str, name: str, value: str, *args: Any, **kwargs: An
kwargs.setdefault("template", "argument_error")
kwargs["name"] = name
kwargs["value"] = value
self.templates["argument_error"] = ERROR_WITH_ARGUMENT
super().__init__("InvalidArgument", message, *args, **kwargs)


Expand All @@ -86,7 +84,6 @@ def __init__(self, msg: str):
class BucketError(S3ClientError):
def __init__(self, *args: Any, **kwargs: Any):
kwargs.setdefault("template", "bucket_error")
self.templates["bucket_error"] = ERROR_WITH_BUCKET_NAME
super().__init__(*args, **kwargs)


Expand All @@ -95,7 +92,6 @@ class BucketAlreadyExists(BucketError):

def __init__(self, *args: Any, **kwargs: Any):
kwargs.setdefault("template", "bucket_error")
self.templates["bucket_error"] = ERROR_WITH_BUCKET_NAME
super().__init__(
"BucketAlreadyExists",
(
Expand All @@ -122,7 +118,6 @@ class MissingKey(S3ClientError):

def __init__(self, **kwargs: Any):
kwargs.setdefault("template", "key_error")
self.templates["key_error"] = ERROR_WITH_KEY_NAME
super().__init__("NoSuchKey", "The specified key does not exist.", **kwargs)


Expand All @@ -140,7 +135,6 @@ def __init__(self, version_id: str, *args: Any, **kwargs: Any):
kwargs.setdefault("template", "argument_error")
kwargs["name"] = "versionId"
kwargs["value"] = version_id
self.templates["argument_error"] = ERROR_WITH_ARGUMENT
super().__init__(
"InvalidArgument", "Invalid version id specified", *args, **kwargs
)
Expand Down Expand Up @@ -447,7 +441,6 @@ class NoSuchUpload(S3ClientError):
def __init__(self, upload_id: Union[int, str], *args: Any, **kwargs: Any):
kwargs.setdefault("template", "error_uploadid")
kwargs["upload_id"] = upload_id
self.templates["error_uploadid"] = ERROR_WITH_UPLOADID
super().__init__(
"NoSuchUpload",
"The specified upload does not exist. The upload ID may be invalid, or the upload may have been aborted or completed.",
Expand All @@ -461,7 +454,6 @@ class PreconditionFailed(S3ClientError):

def __init__(self, failed_condition: str, **kwargs: Any):
kwargs.setdefault("template", "condition_error")
self.templates["condition_error"] = ERROR_WITH_CONDITION_NAME
super().__init__(
"PreconditionFailed",
"At least one of the pre-conditions you specified did not hold",
Expand All @@ -475,7 +467,6 @@ class InvalidRange(S3ClientError):

def __init__(self, range_requested: str, actual_size: str, **kwargs: Any):
kwargs.setdefault("template", "range_error")
self.templates["range_error"] = ERROR_WITH_RANGE
super().__init__(
"InvalidRange",
"The requested range is not satisfiable",
Expand All @@ -499,7 +490,6 @@ class InvalidObjectState(BucketError):

def __init__(self, storage_class: Optional[str], **kwargs: Any):
kwargs.setdefault("template", "storage_error")
self.templates["storage_error"] = ERROR_WITH_STORAGE_CLASS
super().__init__(
error_type="InvalidObjectState",
message="The operation is not valid for the object's storage class",
Expand Down
1 change: 0 additions & 1 deletion moto/sagemaker/exceptions.py
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,6 @@ def __init__(self, *args: Any, **kwargs: Any):
class ModelError(RESTError):
def __init__(self, *args: Any, **kwargs: Any):
kwargs.setdefault("template", "model_error")
self.templates["model_error"] = ERROR_WITH_MODEL_NAME
super().__init__(*args, **kwargs)


Expand Down
1 change: 0 additions & 1 deletion moto/sdb/exceptions.py
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,6 @@ class InvalidParameterError(RESTError):

def __init__(self, **kwargs: Any):
kwargs.setdefault("template", "sdb_error")
self.templates["sdb_error"] = SDB_ERROR
kwargs["error_type"] = "InvalidParameterValue"
super().__init__(**kwargs)

Expand Down

0 comments on commit 58a4e6a

Please sign in to comment.