Add more error handling to the ECR backend
The error messages were copied from `botocore`. New exceptions: RepositoryNotFoundException & ImageNotFoundException.
This commit is contained in:
parent
c9e392a5fe
commit
e4da4f6cd5
5 changed files with 112 additions and 33 deletions
22
moto/ecr/exceptions.py
Normal file
22
moto/ecr/exceptions.py
Normal file
|
|
@ -0,0 +1,22 @@
|
|||
from __future__ import unicode_literals
|
||||
from moto.core.exceptions import RESTError
|
||||
|
||||
|
||||
class RepositoryNotFoundException(RESTError):
|
||||
code = 400
|
||||
|
||||
def __init__(self, repository_name, registry_id):
|
||||
super(RepositoryNotFoundException, self).__init__(
|
||||
error_type="RepositoryNotFoundException",
|
||||
message="The repository with name '{0}' does not exist in the registry "
|
||||
"with id '{1}'".format(repository_name, registry_id))
|
||||
|
||||
|
||||
class ImageNotFoundException(RESTError):
|
||||
code = 400
|
||||
|
||||
def __init__(self, image_id, repository_name, registry_id):
|
||||
super(ImageNotFoundException, self).__init__(
|
||||
error_type="ImageNotFoundException",
|
||||
message="The image with imageId {0} does not exist within the repository with name '{1}' "
|
||||
"in the registry with id '{2}'".format(image_id, repository_name, registry_id))
|
||||
Loading…
Add table
Add a link
Reference in a new issue