moe-serifu-circle / moe-serifu-agent

Anime-themed personal assistant and goal-oriented intelligent agent
GNU Lesser General Public License v3.0
42 stars 7 forks source link

Exceptions are swallowed #138

Open dekarrin opened 5 years ago

dekarrin commented 5 years ago

Describe the bug There are some contexts where exceptions may occur and the task that they occurred in does not properly handle the exception, or does not log the exception, and as a result the information is lost.

There is at least one reproducible context that this can be found in, but there may be other locations as well.

To Reproduce Steps to reproduce the behavior:

  1. In the config file, ensure that the log level is set to debug.
  2. In msa.builtins.core.event.Event class, if there is no __str__() method, add it.
  3. In the same class, in the __str__() method, insert raise ValueError("test") as the first line of the method.
  4. Launch MSA.
  5. The program will instantly quit. An analysis of the logs, even when the log level is configured to be debug, does not show any indication of an exception.

Expected behavior An exception and traceback for the ValueError that was inserted to be included in the log file.

Desktop (please complete the following information):

Additional context This is a code safety issue; having exceptions swallowed loses contextual information on errors. We should look into calling logger.exception() in the except block where exceptions are handled; we might want to ensure that it is always called unless the exception was expected and desired.