From 072c2a26e61c04edf4030a1156cb4c7daf864cac Mon Sep 17 00:00:00 2001 From: furtest Date: Sat, 31 Jan 2026 11:54:23 +0100 Subject: [PATCH] errors : Add program ending function Add a function that quits the program using sys.exit. This is useful when we enconter a fatal error. --- src/unisync/errors.py | 7 +++++++ 1 file changed, 7 insertions(+) diff --git a/src/unisync/errors.py b/src/unisync/errors.py index d52a724..16d33cd 100644 --- a/src/unisync/errors.py +++ b/src/unisync/errors.py @@ -1,6 +1,9 @@ # Copyright (C) 2025-2026 Paul Retourné # SPDX-License-Identifier: GPL-3.0-or-later +from typing import NoReturn +import sys + class RemoteMountedError(Exception): pass @@ -12,3 +15,7 @@ class UnknownSSHError(Exception): class FatalSyncError(Exception): pass + +def unisync_exit_fatal(reason:str) -> NoReturn: + print(reason) + sys.exit(1)