IOError = TIZEN_ERROR_IO_ERROR,
};
+constexpr const char* ErrorToString(int error) {
+ switch (error) {
+ case Error::None:
+ return "None";
+ case Error::InvalidParameter:
+ return "InvalidParameter";
+ case Error::OutOfMemory:
+ return "OutOfMemory";
+ case Error::AppNotFound:
+ return "AppNotFound";
+ case Error::KeyNotFound:
+ return "KeyNotFound";
+ case Error::KeyRejected:
+ return "KeyRejected";
+ case Error::InvalidDataType:
+ return "InvalidDataType";
+ case Error::LaunchRejected:
+ return "LaunchRejected";
+ case Error::PermissionDenied:
+ return "PermissionDenied";
+ case Error::LaunchFailed:
+ return "LaunchFailed";
+ case Error::TimedOut:
+ return "TimedOut";
+ case Error::IOError:
+ return "IOError";
+ default:
+ return "Unknown";
+ }
+ return "Unknown";
+}
+
} // namespace app_control
#endif // APP_CONTROL_ERROR_HH_
#ifndef APP_CONTROL_EXCEPTION_HH_
#define APP_CONTROL_EXCEPTION_HH_
-#include <string>
#include <exception>
+#include <string>
#include "app-control/log_private.hh"
class Exception : public std::exception {
public:
explicit Exception(int error_code, std::string file = __FILE__,
- int line = __LINE__ ) {
- error_code_ = error_code;
+ int line = __LINE__) : error_code_(error_code) {
message_ = file.substr(file.find_last_of("/") + 1) + ":"
- + std::to_string(line) + " code:" + std::to_string(error_code_);
+ + std::to_string(line) + " code:" + ErrorToString(error_code_);
}
virtual ~Exception() {}
return APP_CONTROL_ERROR_OUT_OF_MEMORY;
}
} catch (Exception& e) {
- _E("Failed to get extra data. error(%d)", e.GetErrorCode());
+ _E("Failed to get extra data. error(%s). key: %s",
+ ErrorToString(e.GetErrorCode()), key);
+
return e.GetErrorCode();
}