diff --git a/remindme_caldav.py b/remindme_caldav.py index 1949dfb..1d309bf 100644 --- a/remindme_caldav.py +++ b/remindme_caldav.py @@ -30,20 +30,23 @@ def parse_args(): parser.add_argument('--loglevel', choices=['DEBUG', 'INFO', 'WARNING', 'ERROR', 'CRITICAL'], default='INFO', help='Set the logging level') args = parser.parse_args() if args.config is None: - raise RuntimeError("No config file provided. Please use --config path_to_config.toml") + logging.error("No config file provided. Please use --config path_to_config.toml") + sys.exit(1) return args def read_file(filename): try: return Path(filename).read_text() except FileNotFoundError as e: - raise RuntimeError("Error: The specified file does not exist.") + logging.error("Error: The specified file does not exist.") + sys.exit(1) def parse_toml(content): try: return toml.loads(content) except Exception as e: - raise RuntimeError("Error: Failed to parse TOML file.") + logging.error("Error: Failed to parse TOML file.") + sys.exit(1) def calculate_event_hash(event): return hashlib.md5(json.dumps(event, sort_keys=True, cls=DateTimeEncoder).encode()).hexdigest()