Skip to content

Commit

Permalink
[examples] Add error handling of LightingMgr().Init() (#25398)
Browse files Browse the repository at this point in the history
* [examples] Add error handling of `LightingMgr().Init()`

* Print out CHIP error message

* Use preferred CHIP_ERROR_FORMAT
  • Loading branch information
MonicaisHer committed Mar 22, 2023
1 parent b388c36 commit 9829096
Showing 1 changed file with 7 additions and 1 deletion.
8 changes: 7 additions & 1 deletion examples/lighting-app/linux/main.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -89,7 +89,13 @@ int main(int argc, char * argv[])
return -1;
}

LightingMgr().Init();
CHIP_ERROR err = LightingMgr().Init();
if (err != CHIP_NO_ERROR)
{
ChipLogError(AppServer, "Failed to initialize lighting manager: %" CHIP_ERROR_FORMAT, err.Format());
chip::DeviceLayer::PlatformMgr().Shutdown();
return -1;
}

#if defined(CHIP_IMGUI_ENABLED) && CHIP_IMGUI_ENABLED
example::Ui::ImguiUi ui;
Expand Down

0 comments on commit 9829096

Please sign in to comment.