mirror of
https://github.com/pyMC-dev/pyMC_Repeater.git
synced 2026-07-27 12:03:08 +02:00
3d89174038
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.
18 lines
675 B
Python
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``.
|
|
"""
|