Book a Demo!
CoCalc Logo Icon
StoreFeaturesDocsShareSupportNewsAboutPoliciesSign UpSign In
aws
GitHub Repository: aws/aws-cli
Path: blob/develop/awscli/customizations/ecs/exceptions.py
1567 views
1
# Copyright 2018 Amazon.com, Inc. or its affiliates. All Rights Reserved.
2
#
3
# Licensed under the Apache License, Version 2.0 (the "License"). You
4
# may not use this file except in compliance with the License. A copy of
5
# the License is located at
6
#
7
# http://aws.amazon.com/apache2.0/
8
#
9
# or in the "license" file accompanying this file. This file is
10
# distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF
11
# ANY KIND, either express or implied. See the License for the specific
12
# language governing permissions and limitations under the License.
13
14
15
class ECSError(Exception):
16
""" Base class for all ECSErrors."""
17
fmt = 'An unspecified error occurred'
18
19
def __init__(self, **kwargs):
20
msg = self.fmt.format(**kwargs)
21
super(ECSError, self).__init__(msg)
22
self.kwargs = kwargs
23
24
25
class MissingPropertyError(ECSError):
26
fmt = \
27
"Error: Resource '{resource}' must include property '{prop_name}'"
28
29
30
class FileLoadError(ECSError):
31
fmt = "Error: Unable to load file at {file_path}: {error}"
32
33
34
class InvalidPlatformError(ECSError):
35
fmt = "Error: {resource} '{name}' must support 'ECS' compute platform"
36
37
38
class InvalidProperyError(ECSError):
39
fmt = ("Error: deployment group '{dg_name}' does not target "
40
"ECS {resource} '{resource_name}'")
41
42
43
class InvalidServiceError(ECSError):
44
fmt = "Error: Service '{service}' not found in cluster '{cluster}'"
45
46
47
class ServiceClientError(ECSError):
48
fmt = "Failed to {action}:\n{error}"
49