Skip to content

Commit

Permalink
Add logging when an Api method return is missing or invalid
Browse files Browse the repository at this point in the history
  • Loading branch information
NeonDaniel committed Jun 29, 2023
1 parent 1bb5043 commit c12354a
Showing 1 changed file with 7 additions and 4 deletions.
11 changes: 7 additions & 4 deletions ovos_utils/skills/api.py
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,7 @@

from typing import Dict, Optional
from ovos_bus_client.message import Message
from ovos_utils.log import LOG


class SkillApi:
Expand Down Expand Up @@ -49,11 +50,13 @@ def method(*args, **kwargs):
response = \
SkillApi.bus.wait_for_response(method_msg,
timeout=self.timeout)
if (response and response.data and
'result' in response.data):
return response.data['result']
else:
if not response:
LOG.error(f"Timed out waiting for {method_msg}")
return None
elif 'result' not in response.data:
LOG.error(f"missing `result` in: {response.data}")
else:
return response.data['result']

return method

Expand Down

0 comments on commit c12354a

Please sign in to comment.