Skip to content

Commit

Permalink
No user-facing tb even with invalid summary-format
Browse files Browse the repository at this point in the history
If the user provides an invalid summary-format, we should:
 1. Continue with the execution
 2. Log a warning
 3. Fallback str rather than whatever fancy formatting
  • Loading branch information
asmacdo committed Sep 29, 2024
1 parent 8c9ef9c commit 264ae8b
Showing 1 changed file with 7 additions and 1 deletion.
8 changes: 7 additions & 1 deletion src/con_duct/__main__.py
Original file line number Diff line number Diff line change
Expand Up @@ -578,7 +578,13 @@ def format_field(self, value: Any, format_spec: str) -> Any:
if value is None:
# TODO: could still use our formatter and make it red or smth like that
return self.NONE
return super().format_field(value, format_spec)
try:
return super().format_field(value, format_spec)
except ValueError:
lgr.warning(
f"Value: {value} is invalid for format spec {format_spec}, falling back to `str`"
)
return str(value)


@dataclass
Expand Down

0 comments on commit 264ae8b

Please sign in to comment.