2 // Tizen Web Device API
3 // Copyright (c) 2014 Samsung Electronics Co., Ltd.
5 // Licensed under the Apache License, Version 2.0 (the License);
6 // you may not use this file except in compliance with the License.
7 // You may obtain a copy of the License at
9 // http://www.apache.org/licenses/LICENSE-2.0
11 // Unless required by applicable law or agreed to in writing, software
12 // distributed under the License is distributed on an "AS IS" BASIS,
13 // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
14 // See the License for the specific language governing permissions and
15 // limitations under the License.
18 #include "NotificationUtil.h"
22 #include <PlatformException.h>
25 using namespace DeviceAPI::Common;
28 namespace Notification {
30 void NotificationUtil::throwNotificationException(const int error_code,
31 const std::string &hint)
34 ss << hint << " : " << getNotificationErrorMessage(error_code);
35 LOGE("%s", ss.str().c_str());
38 case NOTIFICATION_ERROR_NOT_EXIST_ID:
39 throw NotFoundException(ss.str().c_str());
41 throw UnknownException(ss.str().c_str());
45 std::string NotificationUtil::getNotificationErrorMessage(const int error_code)
48 case NOTIFICATION_ERROR_INVALID_PARAMETER:
49 return "Invalid parameter";
50 case NOTIFICATION_ERROR_OUT_OF_MEMORY:
51 return "Out of memory";
52 case NOTIFICATION_ERROR_IO_ERROR:
54 case NOTIFICATION_ERROR_PERMISSION_DENIED:
55 return "Permission denied";
56 case NOTIFICATION_ERROR_FROM_DB:
57 return "Error from DB query";
58 case NOTIFICATION_ERROR_ALREADY_EXIST_ID:
59 return "Already exist private ID";
60 case NOTIFICATION_ERROR_FROM_DBUS:
61 return "Error from DBus";
62 case NOTIFICATION_ERROR_NOT_EXIST_ID:
63 return "Not exist private ID";
64 case NOTIFICATION_ERROR_SERVICE_NOT_READY:
65 return "No reponse from notification service";
67 return "Unknown Error";