|
45 | 45 | from aea.crypto.ledger_apis import DEFAULT_CURRENCY_DENOMINATIONS |
46 | 46 | from aea.crypto.wallet import Wallet |
47 | 47 | from aea.decision_maker.base import DecisionMakerHandler |
48 | | -from aea.exceptions import AEAException |
| 48 | +from aea.exceptions import AEAException, _StopRuntime |
49 | 49 | from aea.helpers.exception_policy import ExceptionPolicyEnum |
50 | 50 | from aea.helpers.logging import AgentLoggerAdapter, get_logger |
51 | 51 | from aea.identity.base import Identity |
52 | 52 | from aea.mail.base import Envelope |
53 | 53 | from aea.protocols.base import Message, Protocol |
54 | 54 | from aea.registries.filter import Filter |
55 | 55 | from aea.registries.resources import Resources |
56 | | -from aea.runtime import _StopRuntime |
57 | 56 | from aea.skills.base import Behaviour, Handler |
58 | 57 |
|
59 | 58 |
|
@@ -338,7 +337,7 @@ def handle_envelope(self, envelope: Envelope) -> None: |
338 | 337 | return |
339 | 338 |
|
340 | 339 | for handler in handlers: |
341 | | - handler.handle(msg) |
| 340 | + handler.handle_wrapper(msg) |
342 | 341 |
|
343 | 342 | def _setup_loggers(self): |
344 | 343 | """Set up logger with agent name.""" |
@@ -402,10 +401,14 @@ def exception_handler(self, exception: Exception, function: Callable) -> bool: |
402 | 401 | :return: bool, propagate exception if True otherwise skip it. |
403 | 402 | """ |
404 | 403 | # docstyle: ignore # noqa: E800 |
405 | | - def log_exception(e, fn): |
406 | | - self.logger.exception(f"<{e}> raised during `{fn}`") |
| 404 | + def log_exception(e, fn, is_debug: bool = False): |
| 405 | + if is_debug: |
| 406 | + self.logger.debug(f"<{e}> raised during `{fn}`") |
| 407 | + else: |
| 408 | + self.logger.exception(f"<{e}> raised during `{fn}`") |
407 | 409 |
|
408 | 410 | if self._skills_exception_policy == ExceptionPolicyEnum.propagate: |
| 411 | + log_exception(exception, function, is_debug=True) |
409 | 412 | return True |
410 | 413 |
|
411 | 414 | if self._skills_exception_policy == ExceptionPolicyEnum.stop_and_exit: |
@@ -434,7 +437,6 @@ def teardown(self) -> None: |
434 | 437 |
|
435 | 438 | :return: None |
436 | 439 | """ |
437 | | - self.logger.debug("Calling teardown method...") |
438 | 440 | self.resources.teardown() |
439 | 441 |
|
440 | 442 | def get_task_result(self, task_id: int) -> AsyncResult: |
|
0 commit comments