#include <tizen_core.h>
-#include <utility>
#include <stdexcept>
+#include <utility>
+#include "exception.hh"
#include "log_private.hh"
#include "service_manager.hh"
: info_(std::move(info)), listener_(std::move(listener)) {
if (!Init()) {
Shutdown();
- throw new std::runtime_error("Failed to initialize service");
+ THROW(SERVICE_ERROR_INVALID_CONTEXT);
}
ServiceManager::GetInst().NotifyServiceStateChanged(this);
int ret = tizen_core_task_run(task_);
if (ret != TIZEN_CORE_ERROR_NONE) {
_E("tizen_core_task_run() is failed");
- throw new std::runtime_error("Failed to run service");
+ THROW(SERVICE_ERROR_INVALID_CONTEXT);
}
running_ = true;
}
tizen_core_channel_object_destroy(object);
if (ret != TIZEN_CORE_ERROR_NONE) {
_E("tizen_core_channel_send() is failed. error=%d", ret);
- throw new std::runtime_error("Failed to send message");
+ THROW(SERVICE_ERROR_IO_ERROR);
}
}
: argc_(argc), argv_(argv), name_(std::move(name)) {
if (!Init()) {
Shutdown();
- throw new std::runtime_error("Failed to initializer service loader");
+ THROW(SERVICE_ERROR_INVALID_CONTEXT);
}
}