Skip to content

Commit 3b64e66

Browse files
change: error raise
1 parent a8a1ce7 commit 3b64e66

File tree

1 file changed

+1
-7
lines changed

1 file changed

+1
-7
lines changed

redis/lock.py

Lines changed: 1 addition & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -251,13 +251,7 @@ def release(self) -> None:
251251
"""
252252
expected_token = self.local.token
253253
if expected_token is None:
254-
if self.owned():
255-
raise LockError("Cannot release an unlocked lock", lock_name=self.name)
256-
else:
257-
raise LockNotOwnedError(
258-
"Cannot release a lock that's no longer owned",
259-
lock_name=self.name,
260-
)
254+
raise LockError("Cannot release a lock that's not owned or is already unlocked.", lock_name=self.name)
261255
self.local.token = None
262256
self.do_release(expected_token)
263257

0 commit comments

Comments
 (0)