feat: Print FatalError messages using Logger (#2292)

* feat: Print FatalError messages using Logger

This makes them appear GHA annotations in CI logs, which makes them easier to spot. I've also added the "cibuildwheel: " prefix to those errors, I think it helps when viewing a log to know which tool is talking to you - it can be difficult to understand with build tools.

* Nicer error message on invalid architecture

* Fix some message formatting and test expectations
This commit is contained in:
Joe Rickerby
2025-03-01 10:47:44 +01:00
committed by GitHub
parent 708cf1d32b
commit 9e72cd9b54
6 changed files with 28 additions and 23 deletions
+7 -1
View File
@@ -8,6 +8,8 @@ from collections.abc import Set
from enum import StrEnum, auto
from typing import Final, Literal
from cibuildwheel import errors
from .typing import PlatformName
PRETTY_NAMES: Final[dict[PlatformName, str]] = {
@@ -78,7 +80,11 @@ class Architecture(StrEnum):
elif arch_str == "auto32":
result |= Architecture.bitness_archs(platform=platform, bitness="32")
else:
result.add(Architecture(arch_str))
try:
result.add(Architecture(arch_str))
except ValueError as e:
msg = f"Invalid architecture '{arch_str}'"
raise errors.ConfigurationError(msg) from e
return result
@staticmethod