Closed iavael closed 10 years ago
This is a change we made to give the caller a chance to do something when an exception occurs, instead of swallowing the exception internally. You can look at the changes in targetcli-fb's script:
while not shell._exit:
try:
shell.run_interactive()
except (RTSLibError, ExecutionError) as msg:
shell.log.error(str(msg))
basically just handling the exception (if desired) and then re-invoking the shell if an explicit exit command has not been given.
Ok, I agree that catching this exception is necessary. But if shell initialization is heavy it may be reasonable to let user catch exception closer to it's raise, so that there would be no need to reinitialize shell context.
It's just re-invoking run_interactive, which is not a big deal as far as I can tell.
Ok, I've got it, thanks for your help.
When user tries to call non-existing command, library thows exception, which could be caught only after shell context termination and the only is to restart the shell.