summaryrefslogtreecommitdiff
path: root/notification-ex/manager.cc
diff options
context:
space:
mode:
authorhyunho <hhstark.kang@samsung.com>2019-03-21 10:22:38 +0900
committerhyunho <hhstark.kang@samsung.com>2019-03-22 11:50:05 +0900
commit6331648ecf9301a43ed1037e398e66139c0572bf (patch)
treebe909be327f2f7dd666514228a73cf381af1d783 /notification-ex/manager.cc
parent1deac3cc3ed73a104e6249f5a1814aa3821b9548 (diff)
downloadnotification-6331648ecf9301a43ed1037e398e66139c0572bf.tar.gz
notification-6331648ecf9301a43ed1037e398e66139c0572bf.tar.bz2
notification-6331648ecf9301a43ed1037e398e66139c0572bf.zip
Add error handling feature
Change-Id: Icfb7df4ddcc021487a6ef12ac3e4bdd1bb7094e2 Signed-off-by: hyunho <hhstark.kang@samsung.com>
Diffstat (limited to 'notification-ex/manager.cc')
-rw-r--r--notification-ex/manager.cc21
1 files changed, 21 insertions, 0 deletions
diff --git a/notification-ex/manager.cc b/notification-ex/manager.cc
index 32fa971..a3be687 100644
--- a/notification-ex/manager.cc
+++ b/notification-ex/manager.cc
@@ -71,6 +71,14 @@ int Manager::Impl::SendNotify(shared_ptr<item::AbstractItem> noti,
return info.GetRequestId();
}
+void Manager::SendError(const IEventInfo& info, NotificationError error) {
+ list<Bundle> serialized_list {};
+ IEventInfo& i = const_cast<IEventInfo&>(info);
+ static_cast<IEventInfoInternal&>(i).SetError(error);
+ static_cast<IEventInfoInternal&>(i).SetEventType(EventInfo::Error);
+ impl_->sender_->Notify(info, serialized_list, info.GetOwner());
+}
+
int Manager::Update(shared_ptr<item::AbstractItem> noti) {
return impl_->SendNotify(noti, EventInfo::Update);
}
@@ -128,6 +136,14 @@ list<Bundle> Manager::OnRequest(const IEventInfo& info) {
void Manager::OnEvent(const IEventInfo& info, list<Bundle> serialized) {
shared_ptr<AbstractItem> gen_item;
const IEventInfo::EventType type = info.GetEventType();
+ NotificationError error =
+ (static_cast<const IEventInfoInternal&>(info)).GetError();
+ if (error != NOTIFICATION_ERROR_NONE) {
+ LOGE("Handling error event (%d)", error);
+ OnError(error, info.GetRequestId());
+ return;
+ }
+
switch(type) {
case EventInfo::Post: {
list<shared_ptr<item::AbstractItem>> added;
@@ -158,6 +174,8 @@ void Manager::OnEvent(const IEventInfo& info, list<Bundle> serialized) {
}
case EventInfo::Get:
break;
+ case EventInfo::Error:
+ break;
}
}
@@ -173,6 +191,9 @@ void Manager::OnDelete(const IEventInfo& info,
shared_ptr<item::AbstractItem> deletedItem) {
}
+void Manager::OnError(NotificationError error, int requestId) {
+}
+
list<shared_ptr<item::AbstractItem>> Manager::OnRequestEvent(const IEventInfo& info) {
return list<shared_ptr<item::AbstractItem>>({});
}