Added exception handling

Handles exceptions from the command executor.