::pkgmgrinfo_pkginfo_destroy_pkginfo(this->m_handle);
}
+const std::string PackageInfo::UNKNOWN = "Unknown";
+
std::string PackageInfo::getIconPath(void)
{
char *icon = nullptr;
auto ret = ::pkgmgrinfo_pkginfo_get_icon(this->m_handle, &icon);
- if (ret != PMINFO_R_OK)
- ThrowExc(InternalError,
- "Failed to get icon with pkginfo. ret: " << ret);
-
- if (icon == nullptr)
- ThrowExc(InternalError,
- "pkgmgrinfo_pkginfo_get_icon success"
- ", but null returned on icon path.");
+ if (ret != PMINFO_R_OK || icon == nullptr) {
+ WARN("Failed to get icon with pkginfo. ret: " << ret);
+ return this->UNKNOWN;
+ }
return std::string(icon);
}
{
char *version = nullptr;
auto ret = ::pkgmgrinfo_pkginfo_get_version(this->m_handle, &version);
- if (ret != PMINFO_R_OK)
- ThrowExc(InternalError,
- "Failed to get version with pkginfo. ret: " << ret);
-
- if (version == nullptr)
- ThrowExc(InternalError,
- "pkgmgrinfo_pkginfo_get_version success"
- ", but null returned on icon path.");
+ if (ret != PMINFO_R_OK || version == nullptr) {
+ WARN("Failed to get version with pkginfo. ret: " << ret);
+ return this->UNKNOWN;
+ }
return std::string(version);
}
{
char *label = nullptr;
auto ret = ::pkgmgrinfo_pkginfo_get_label(this->m_handle, &label);
- if (ret != PMINFO_R_OK)
- ThrowExc(InternalError,
- "Failed to get label with pkginfo. ret: " << ret);
-
- if (label == nullptr)
- ThrowExc(InternalError,
- "pkgmgrinfo_pkginfo_get_label success"
- ", but null returned on icon path.");
+ if (ret != PMINFO_R_OK || label == nullptr) {
+ WARN("Failed to get label with pkginfo. ret: " << ret);
+ return this->UNKNOWN;
+ }
return std::string(label);
}