provide better feedback when we have exhausted all config_pb2 options

Signed-off-by: Brian S. Stephan <bss@incorporeal.org>
This commit is contained in:
Brian S. Stephan 2024-12-17 13:39:40 -06:00
parent 62c7fad02c
commit 9dd1d0dc53
Signed by: bss
GPG Key ID: 3DE06D3180895FCB
2 changed files with 3 additions and 2 deletions

View File

@ -68,7 +68,8 @@ def get_config_pb2(with_fallback: bool = args.use_shipped_fallback):
except (ModuleNotFoundError, TypeError): except (ModuleNotFoundError, TypeError):
# (TypeError could be the windows bug https://github.com/protocolbuffers/protobuf/issues/14345) # (TypeError could be the windows bug https://github.com/protocolbuffers/protobuf/issues/14345)
if not with_fallback: if not with_fallback:
raise logger.exception("no viable set of protobuf modules could be found, please use -P or -S!")
raise RuntimeError("no viable set of protobuf modules could be found, please use -P or -S!")
# that failed, import the snapshot (may be lagging what's in GP2040-CE) # that failed, import the snapshot (may be lagging what's in GP2040-CE)
logger.warning("using the fallback .proto files! please supply your files with -P if you can!") logger.warning("using the fallback .proto files! please supply your files with -P if you can!")

View File

@ -52,7 +52,7 @@ def test_get_config_pb2_precompiled():
def test_get_config_pb2_exception(): def test_get_config_pb2_exception():
"""Test that we fail if no config .proto files are available.""" """Test that we fail if no config .proto files are available."""
with pytest.raises(ModuleNotFoundError): with pytest.raises(RuntimeError):
_ = get_config_pb2() _ = get_config_pb2()