I would rewrite above as
```
if (ret != APP_MANAGER_ERROR_NONE && app_id) {
  app_id_ = app_id;
  return;
}

std::cerr << "Fail to get app id by pid: " << ret << std::endl;
switch (ret) {
  ...
}
```