Moved LockError into exceptions.py
This commit is contained in:
parent
4be89866ee
commit
59b634498b
1 changed files with 19 additions and 1 deletions
|
|
@ -1,2 +1,20 @@
|
||||||
|
from threading import ThreadError
|
||||||
|
|
||||||
class TaskDeniedException(Exception):
|
class TaskDeniedException(Exception):
|
||||||
pass
|
pass
|
||||||
|
|
||||||
|
class LockError(ThreadError):
|
||||||
|
ERROR_CODES = {
|
||||||
|
'ACQUIRE_ERROR': "Unable to acquire. Lock in use by another thread.",
|
||||||
|
'IN_USE_ERROR': "Lock in use by another thread."
|
||||||
|
}
|
||||||
|
|
||||||
|
def __init__(self, code, lock):
|
||||||
|
self.code = code
|
||||||
|
if code in LockError.ERROR_CODES:
|
||||||
|
self.message = LockError.ERROR_CODES[code]
|
||||||
|
else:
|
||||||
|
self.message = "Unknown error."
|
||||||
|
print("{}: {}".format(self.code, self.message))
|
||||||
|
|
||||||
|
ThreadError.__init__(self)
|
||||||
Loading…
Add table
Add a link
Reference in a new issue