Skip to content

Commit 0921242

Browse files
authored
Create deployment error (#4920)
Contribute towards b/440042223 It create a Deployment Error class and uses it for Deployment failure. It also fixes the issuance of the metric for failures. It seems the way that the metrics client is implemented, it's not allowed to emit the metric in a exception handling block. --------- Signed-off-by: Javan Lacerda <javanlacerda@google.com>
1 parent 31ae311 commit 0921242

File tree

1 file changed

+5
-1
lines changed

1 file changed

+5
-1
lines changed

src/local/butler/deploy.py

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -51,6 +51,10 @@
5151
Version = namedtuple('Version', ['id', 'deploy_time', 'traffic_split'])
5252

5353

54+
class DeploymentError(Exception):
55+
"""Deployment Error"""
56+
57+
5458
def now(tz=None):
5559
"""Used for mocks."""
5660
return datetime.datetime.now(tz)
@@ -445,7 +449,7 @@ def _prod_deployment_helper(config_dir,
445449
except Exception as ex:
446450
labels.update({'success': False})
447451
monitoring_metrics.PRODUCTION_DEPLOYMENT.increment(labels)
448-
raise ex
452+
raise DeploymentError from ex
449453

450454

451455
def _deploy_terraform(config_dir):

0 commit comments

Comments
 (0)