Merge "Make sure the exception is a CommandException before casting it to one." into lmp-mr1-dev