Skip to content

Commit f55a87a

Browse files
committed
Update based on further Copilot review
* Sort list before raising error containing the list
1 parent 63bac33 commit f55a87a

1 file changed

Lines changed: 2 additions & 3 deletions

File tree

dsc/utils/aws/metrics.py

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -116,9 +116,8 @@ def _validate_metric_unit(self, unit: str) -> bool:
116116
ValueError: If unit is not allowed by AWS CloudWatch.
117117
"""
118118
if unit not in UNIT_VALUES:
119-
raise ValueError(
120-
f"Invalid unit '{unit}'. Must be one of: {', '.join(sorted(UNIT_VALUES))}"
121-
)
119+
allowed_units = ", ".join(sorted(UNIT_VALUES))
120+
raise ValueError(f"Invalid unit '{unit}'. Must be one of: {allowed_units}")
122121
return True
123122

124123
def _publish_metrics(self, metrics: list[Metric]) -> None:

0 commit comments

Comments
 (0)