Skip to content

Commit

Permalink
error handling
Browse files Browse the repository at this point in the history
  • Loading branch information
JarbasAl committed Jan 24, 2025
1 parent 9882d00 commit 679fd99
Showing 1 changed file with 10 additions and 1 deletion.
11 changes: 10 additions & 1 deletion ovos_padatious/opm.py
Original file line number Diff line number Diff line change
Expand Up @@ -430,7 +430,10 @@ def handle_detach_skill(self, message):
Args:
message (Message): message triggering action
"""
skill_id = message.data['skill_id']
skill_id = message.data.get("skill_id") or message.context.get("skill_id")
if not skill_id:
LOG.error("Skill ID is missing. Cannot detach intent without a valid skill ID.")
return
for i in self._skill2intent[skill_id]:
self.__detach_intent(i)

Expand All @@ -443,6 +446,9 @@ def _register_object(self, message, object_name, register_func):
register_func (callable): function to call for registration
"""
skill_id = message.data.get("skill_id") or message.context.get("skill_id")
if not skill_id:
LOG.error("Skill ID is missing. Cannot register intent without a valid skill ID.")
return
file_name = message.data.get('file_name')
samples = message.data.get("samples")
name = message.data['name']
Expand Down Expand Up @@ -484,6 +490,9 @@ def register_intent(self, message):
message (Message): message triggering action
"""
skill_id = message.data.get("skill_id") or message.context.get("skill_id")
if not skill_id:
LOG.error("Skill ID is missing. Cannot register intent without a valid skill ID.")
return
self._skill2intent[skill_id].append(message.data['name'])

lang = message.data.get('lang', self.lang)
Expand Down

0 comments on commit 679fd99

Please sign in to comment.