-
Hi everyone, As I was implementing a dynamic command loop for my Discord Bot, I had to look inside the Loop class and I notice something strange. Here is the method in particular
My problem with that is in the last part, handling exception. As we can see, if there is almost any exception, it will be caught with the line So my question/discussions is : is this behavior intended ? It seems to me that the variable _has_failed is next to useless since it is always reset almost immediately I see the sense in that, since we should have it back to False to loop again, but the problem is that I think we will never be able to see in any code that the variable _has_failed is True and its sole use is to know if the coro had an exception or not I'm writing this because for my loop command, I want to know if the given command to be executed every X second failed or not but _has_failed always returns False even if the coro raised an exception (and only once, since its execution seems stopped after raising the exception) I'm not sure if this is an issue or maybe a miscomprehension on my part so that's why I'm posting it here and not in issues |
Beta Was this translation helpful? Give feedback.
Replies: 1 comment
-
You're misreading the code. The outer finally (outside of the |
Beta Was this translation helpful? Give feedback.
You're misreading the code.
The outer finally (outside of the
while True
) resets the state of the loop class so it can be reused.