I change it to use "beforeExecuteCommand" with try/catch wrapping since I have trouble with adding a require() call to PopUpManager in this module.

@redmunds Sorry,  I don't have a general solution that can fix your bugs. And your issues may require other modules to fire an event and not from CommandManager module.