2 // Tizen Web Device API
3 // Copyright (c) 2013 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 #ifndef __TIZEN_SYSTEMINFO_SYSTEMINFO_UTIL_H__
19 #define __TIZEN_SYSTEMINFO_SYSTEMINFO_UTIL_H__
24 #include <PlatformException.h>
27 namespace SystemInfo {
29 class SystemInfoUtil {
32 static std::string getSystemInfoErrorMessage(const int errorCode);
33 static std::string getConnectionErrorMessage(const int errorCode);
34 static std::string getTapiErrorMessage(const int errorCode);
35 static std::string getSettingErrorMessage(const int errorCode);
36 static std::string getWIFIErrorMessage(const int errorCode);
39 template<class T = DeviceAPI::Common::UnknownException>
40 static void throwSystemInfoException(const int errorCode, const std::string& hint)
43 ss << hint << " : " << getSystemInfoErrorMessage(errorCode);
44 LOGE("%s", ss.str().c_str());
46 throw T(ss.str().c_str());
49 template<class T = DeviceAPI::Common::UnknownException>
50 static void throwConnectionException(const int errorCode, const std::string& hint)
53 ss << hint << " : " << getConnectionErrorMessage(errorCode);
54 LOGE("%s", ss.str().c_str());
56 throw T(ss.str().c_str());
59 template<class T = DeviceAPI::Common::UnknownException>
60 static void throwTapiException(const int errorCode, const std::string& hint)
63 ss << hint << " : " << getTapiErrorMessage(errorCode);
64 LOGE("%s", ss.str().c_str());
66 throw T(ss.str().c_str());
69 template<class T = DeviceAPI::Common::UnknownException>
70 static void throwSettingException(const int errorCode, const std::string& hint)
73 ss << hint << " : " << getSettingErrorMessage(errorCode);
74 LOGE("%s", ss.str().c_str());
76 throw T(ss.str().c_str());
79 template<class T = DeviceAPI::Common::UnknownException>
80 static void throwWIFIException(const int errorCode, const std::string& hint)
83 ss << hint << " : " << getWIFIErrorMessage(errorCode);
84 LOGE("%s", ss.str().c_str());
86 throw T(ss.str().c_str());
94 #endif /* __TIZEN_SYSTEMINFO_SYSTEMINFO_UTIL_H__ */