The capi function sensor_listener_start may throw std::invalid_argument
but this function can be used in C(which cannot handle thrown
exceptions) so a try-catch statement is added to handle this exception.
Change-Id: Ie5fd0d751e86697e08ea55f23c764bf224791322
Signed-off-by: SangYoun Kwak <sy.kwak@samsung.com>
id = listener->id;
pause = listener->pause;
- if (!sensord_start(id, 0))
+ try {
+ if (!sensord_start(id, 0))
+ return SENSOR_ERROR_OPERATION_FAILED;
+ } catch (std::invalid_argument &e) {
+ _E("sensord_start failed: %s", e.what());
return SENSOR_ERROR_OPERATION_FAILED;
+ }
if (sensord_listener_set_attribute_int(id, SENSOR_ATTRIBUTE_PAUSE_POLICY, pause) < 0)
return SENSOR_ERROR_OPERATION_FAILED;