From 1b54b23bb314eea24377a8946789564e97e82540 Mon Sep 17 00:00:00 2001 From: Unrud Date: Wed, 7 Jun 2017 14:14:09 +0200 Subject: [PATCH] Add info about disabling locking to error message --- radicale/storage.py | 13 ++++++++----- 1 file changed, 8 insertions(+), 5 deletions(-) diff --git a/radicale/storage.py b/radicale/storage.py index 711e7fc..f77143c 100644 --- a/radicale/storage.py +++ b/radicale/storage.py @@ -1268,17 +1268,20 @@ class Collection(BaseCollection): flags = LOCKFILE_EXCLUSIVE_LOCK if mode == "w" else 0 overlapped = Overlapped() if not lock_file_ex(handle, flags, 0, 1, 0, overlapped): - raise RuntimeError("Locking the storage failed: %s" % - ctypes.FormatError()) + raise RuntimeError("Locking the storage failed " + "(can be disabled in the config): " + "%s" % ctypes.FormatError()) elif os.name == "posix": _cmd = fcntl.LOCK_EX if mode == "w" else fcntl.LOCK_SH try: fcntl.flock(cls._lock_file.fileno(), _cmd) except OSError as e: - raise RuntimeError("Locking the storage failed: %s" % - e) from e + raise RuntimeError("Locking the storage failed " + "(can be disabled in the config): " + "%s" % e) from e else: - raise RuntimeError("Locking the storage failed: " + raise RuntimeError("Locking the storage failed " + "(can be disabled in the config): " "Unsupported operating system") cls._lock_file_locked = True try: