Check if command exists and throw exception if it doesn't