blob: 6c7d98b2978df5528eb6df826027255ae7259f0a [file] [log] [blame]
Jayanth Othayoth1756c062017-05-23 22:48:11 -05001#include <exception>
2#include "dump_watch.hpp"
3#include <phosphor-logging/log.hpp>
4#include <phosphor-logging/elog.hpp>
5#include <phosphor-logging/elog-errors.hpp>
6#include "elog-errors.hpp"
7#include <xyz/openbmc_project/Dump/Monitor/error.hpp>
8#include "xyz/openbmc_project/Common/error.hpp"
9
10int main(int argc, char* argv[])
11{
12 sd_event* loop = nullptr;
13 sd_event_default(&loop);
14
15 using namespace phosphor::logging;
16
17 using InvalidCorePath =
18 sdbusplus::xyz::openbmc_project::Dump::Monitor::Error::InvalidCorePath;
19 using InternalFailure =
20 sdbusplus::xyz::openbmc_project::Common::Error::InternalFailure;
21
22 try
23 {
24 phosphor::dump::inotify::Watch watch(loop);
25 sd_event_loop(loop);
26 }
27
28 catch (InvalidCorePath& e)
29 {
30 commit<InvalidCorePath>();
31 return -1;
32 }
33
34 catch (InternalFailure& e)
35 {
36 commit<InternalFailure>();
37 return -1;
38 }
39
40 sd_event_unref(loop);
41
42 return 0;
43}