moe-serifu-agent
moe-serifu-agent copied to clipboard
Exceptions are swallowed
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:
- In the config file, ensure that the log level is set to debug.
- In
msa.builtins.core.event.Event
class, if there is no__str__()
method, add it. - In the same class, in the
__str__()
method, insertraise ValueError("test")
as the first line of the method. - Launch MSA.
- 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):
- OS: Windows 10
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.