fix: added assertion error message
This commit is contained in:
@@ -24,7 +24,7 @@ class ActionFlow:
|
||||
def do(self, action: type[Action]):
|
||||
name = action.__name__
|
||||
index = self.indices.get(name)
|
||||
assert index is not None
|
||||
assert index is not None, "Action '%s' is not registered" % name
|
||||
|
||||
if self.on[index]: raise Unavailable(name)
|
||||
if self.on[index] is None: raise NotAllowed(name)
|
||||
@@ -40,7 +40,7 @@ class ActionFlow:
|
||||
def index(self, action: type[Action]) -> int:
|
||||
name = action.__name__
|
||||
index = self.indices.get(name)
|
||||
assert index is not None
|
||||
assert index is not None, "Action '%s' is not registered" % name
|
||||
return index
|
||||
|
||||
def allow(self, action: type[Action], value=True):
|
||||
|
||||
@@ -14,9 +14,9 @@ class Timer:
|
||||
self.checkpoint = seconds
|
||||
|
||||
def pause(self):
|
||||
assert self.checkpoint is not None
|
||||
assert self.checkpoint is not None, "Uninitialized"
|
||||
self.accumulator = self.delta()
|
||||
|
||||
def delta(self):
|
||||
assert self.checkpoint is not None
|
||||
assert self.checkpoint is not None, "Uninitialized"
|
||||
return floor(time()) - self.checkpoint + self.accumulator
|
||||
|
||||
Reference in New Issue
Block a user