Files
pyMC_Repeater/repeater/exceptions.py
T
agessaman 3d89174038 fix(repeater): report all boot-time config errors without a stack trace
Startup config mistakes were handled inconsistently: an identity collision
exited cleanly, but a missing or invalid config file (FileNotFoundError /
RuntimeError from load_config) and a missing identity key (RuntimeError) dumped
a full traceback -- and load_config ran outside main()'s try, so those errors
escaped the fatal handler entirely.

Add repeater/exceptions.py with ConfigurationError(RuntimeError) and re-parent
IdentityConfigurationError onto it (it stays a RuntimeError, so existing
except-sites are unaffected). Raise ConfigurationError for the missing/invalid
config file, the config-load failure, and the missing identity key. Move
load_config and daemon construction inside main()'s try and catch
ConfigurationError there, logging just the message and exiting 1; unexpected
failures still log with a traceback.
2026-07-24 08:50:34 -07:00

18 lines
675 B
Python

"""Shared exception types for the repeater.
Kept dependency-free (no other ``repeater`` imports) so any module can raise
these without risking an import cycle.
"""
class ConfigurationError(RuntimeError):
"""A user-actionable configuration problem.
Raised for boot-time config mistakes (missing/invalid config file, missing
required keys, colliding local identities). ``main()`` reports the message
and exits non-zero *without* a stack trace, since the fix is in the config,
not the code. Subclasses ``RuntimeError`` so existing ``except
RuntimeError`` sites keep catching the errors that used to be raised as
plain ``RuntimeError``.
"""