Skip to content

Commit 5925d95

Browse files
committed
add try catch when state has no actions
1 parent 5aee9f4 commit 5925d95

1 file changed

Lines changed: 8 additions & 1 deletion

File tree

jupyddl/automated_planner.py

Lines changed: 8 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -64,7 +64,14 @@ def transition(self, state, action):
6464
return self.pddl.transition(self.domain, state, action, check=False)
6565

6666
def available_actions(self, state):
67-
return self.pddl.available(state, self.domain)
67+
try:
68+
return self.pddl.available(state, self.domain)
69+
except (RuntimeError, TypeError, NameError):
70+
self.logger.warning("Runtime, Type or Name error occured when fetching available action from state" + str(state))
71+
return []
72+
else:
73+
self.logger.warning("An error occured when fetching available action from state" + str(state))
74+
return []
6875

6976
def satisfies(self, asserted_state, state):
7077
return self.pddl.satisfy(asserted_state, state, self.domain)[0]

0 commit comments

Comments
 (0)