20
20
from cdpcli .client import ClientCreator , Context
21
21
from cdpcli .credentials import Credentials
22
22
from cdpcli .endpoint import EndpointCreator , EndpointResolver
23
- from cdpcli .exceptions import ClientError
23
+ from cdpcli .exceptions import ClientError , ParamValidationError
24
24
from cdpcli .loader import Loader
25
25
from cdpcli .parser import ResponseParserFactory
26
26
from cdpcli .retryhandler import create_retry_handler
@@ -65,13 +65,23 @@ def __init__(self, base_error, *args):
65
65
except KeyError :
66
66
self .error_code = ''
67
67
self .violations = _violations
68
- self .message = _violations
68
+ self .message = "Client request error"
69
69
self .status_code = _payload .group (1 )
70
70
self .rc = 1
71
71
self .service = _payload .group (3 )
72
72
self .operation = _payload .group (4 )
73
73
self .request_id = _payload .group (5 )
74
74
75
+ if isinstance (self .base_error , ParamValidationError ):
76
+ _PARAM_ERROR_PATTERN = re .compile (
77
+ r"Parameter validation failed:\n([\s\S]*)"
78
+ )
79
+ _payload = re .search (_PARAM_ERROR_PATTERN , str (self .base_error ))
80
+ _violations = _payload .group (1 ).split ('\n ' )
81
+ self .violations = _violations
82
+ self .message = "Parameter validation error"
83
+ self .error_code = 'PARAMETER_VALIDATION_ERROR'
84
+
75
85
super ().__init__ (base_error , * args )
76
86
77
87
def update (self , * args , ** kwargs ):
@@ -186,6 +196,7 @@ def _warning_format(message, category, filename, lineno, line=None):
186
196
'STOP_IN_PROGRESS' ,
187
197
'STOPPED' ,
188
198
'ENV_STOPPED' ,
199
+ 'Stopped' , # DW
189
200
'NOT_ENABLED' # DF
190
201
]
191
202
@@ -207,7 +218,7 @@ def _warning_format(message, category, filename, lineno, line=None):
207
218
'AVAILABLE' , 'UPDATE_FAILED' , 'CREATE_FAILED' , 'ENABLE_SECURITY_FAILED' , 'DELETE_FAILED' ,
208
219
'DELETE_COMPLETED' , 'DELETED_ON_PROVIDER_SIDE' , 'STOPPED' , 'START_FAILED' , 'STOP_FAILED' ,
209
220
'installation:failed' , 'deprovision:failed' , 'installation:finished' , # ML
210
- 'Error' , 'Running' , # DW
221
+ 'Error' , 'Running' , 'Stopped' , 'Deleting' , # DW
211
222
'GOOD_HEALTH' , 'CONCERNING_HEALTH' , 'BAD_HEALTH' , # DF
212
223
]
213
224
0 commit comments