If reflex_message() fails to find a Reflex for whatever reason, it throws an exception. The code handling the exception expects the reflex variable to have been set, but in this method that variable only gets set inside the try block, so by definition it doesn't exist if the exception needs to be handled. self.broadcast_error() mandates the Reflex as a positional argument, but has conditional logic inside it that handles a case where the variable is falsey, so passing None in that spot solves the problem. I also added a little more detail to the text of the error message.
After I fixed that, I noticed that the following except block had message and msg used inconsistently (msg was never getting assigned), so I changed that to match the first block.
If
reflex_message()
fails to find a Reflex for whatever reason, it throws an exception. The code handling the exception expects thereflex
variable to have been set, but in this method that variable only gets set inside thetry
block, so by definition it doesn't exist if the exception needs to be handled.self.broadcast_error()
mandates the Reflex as a positional argument, but has conditional logic inside it that handles a case where the variable is falsey, so passingNone
in that spot solves the problem. I also added a little more detail to the text of the error message.Fixes #52