Update error handling for getCommand method