Skip to content

Commit

Permalink
Merge pull request #979 from puddly/puddly/listener-exception-logging
Browse files Browse the repository at this point in the history
Log the entire listener exception traceback when an error occurs
  • Loading branch information
puddly committed Apr 27, 2022
2 parents c519492 + 054a8e4 commit cab1032
Showing 1 changed file with 15 additions and 2 deletions.
17 changes: 15 additions & 2 deletions zigpy/util.py
Original file line number Diff line number Diff line change
Expand Up @@ -50,7 +50,12 @@ def listener_event(self, method_name, *args):
else:
result.append(method(*args))
except Exception as e:
LOGGER.warning("Error calling listener.%s: %s", method_name, e)
LOGGER.warning(
"Error calling listener %r with args %r: %r", method, args, e
)
LOGGER.debug(
"Error calling listener %r with args %r", method, args, exc_info=e
)
return result

async def async_event(self, method_name, *args):
Expand All @@ -69,7 +74,15 @@ async def async_event(self, method_name, *args):
results = []
for result in await asyncio.gather(*tasks, return_exceptions=True):
if isinstance(result, Exception):
LOGGER.warning("Error calling listener: %s", result)
LOGGER.warning(
"Error calling listener %r with args %r: %r", method, args, result
)
LOGGER.debug(
"Error calling listener %r with args %r",
method,
args,
exc_info=result,
)
else:
results.append(result)
return results
Expand Down

0 comments on commit cab1032

Please sign in to comment.