handle any exception raised by a command