mirror of
https://github.com/AyuGram/AyuGramDesktop.git
synced 2025-04-16 06:07:06 +02:00
Avoid unneeded std::string casts in exception handling
This commit is contained in:
parent
a54bc449e4
commit
e0b4d1edce
4 changed files with 10 additions and 17 deletions
|
@ -26,8 +26,7 @@ void UnsafeOpenUrl(const QString &url) {
|
|||
base::Platform::AppLaunchContext());
|
||||
|
||||
if (!result) {
|
||||
LOG(("App Error: %1").arg(
|
||||
QString::fromStdString(result.error().what())));
|
||||
LOG(("App Error: %1").arg(result.error().what()));
|
||||
} else if (*result) {
|
||||
return;
|
||||
}
|
||||
|
@ -52,8 +51,7 @@ void UnsafeLaunch(const QString &filepath) {
|
|||
if ([&] {
|
||||
const auto filename = GLib::filename_to_uri(filepath.toStdString());
|
||||
if (!filename) {
|
||||
LOG(("App Error: %1").arg(
|
||||
QString::fromStdString(filename.error().what())));
|
||||
LOG(("App Error: %1").arg(filename.error().what()));
|
||||
|
||||
return false;
|
||||
}
|
||||
|
@ -63,8 +61,7 @@ void UnsafeLaunch(const QString &filepath) {
|
|||
base::Platform::AppLaunchContext());
|
||||
|
||||
if (!result) {
|
||||
LOG(("App Error: %1").arg(
|
||||
QString::fromStdString(result.error().what())));
|
||||
LOG(("App Error: %1").arg(result.error().what()));
|
||||
|
||||
return false;
|
||||
}
|
||||
|
|
|
@ -174,7 +174,7 @@ gi::ref_ptr<Application> MakeApplication() {
|
|||
const auto result = gi::make_ref<Application>();
|
||||
if (const auto registered = result->register_(); !registered) {
|
||||
LOG(("App Error: Failed to register: %1").arg(
|
||||
QString::fromStdString(registered.error().message_())));
|
||||
registered.error().message_().c_str()));
|
||||
return nullptr;
|
||||
}
|
||||
return result;
|
||||
|
|
|
@ -58,8 +58,7 @@ void Noexcept(Fn<void()> callback, Fn<void()> failed = nullptr) noexcept {
|
|||
callback();
|
||||
return;
|
||||
} catch (const std::exception &e) {
|
||||
LOG(("Native Notification Error: %1").arg(
|
||||
QString::fromStdString(e.what())));
|
||||
LOG(("Native Notification Error: %1").arg(e.what()));
|
||||
}
|
||||
|
||||
if (failed) {
|
||||
|
|
|
@ -68,8 +68,7 @@ void PortalAutostart(bool enabled, Fn<void(bool)> done) {
|
|||
Gio::DBus::BusType::SESSION);
|
||||
} catch (const std::exception &e) {
|
||||
if (done) {
|
||||
LOG(("Portal Autostart Error: %1").arg(
|
||||
QString::fromStdString(e.what())));
|
||||
LOG(("Portal Autostart Error: %1").arg(e.what()));
|
||||
}
|
||||
return Glib::RefPtr<Gio::DBus::Connection>();
|
||||
}
|
||||
|
@ -144,8 +143,7 @@ void PortalAutostart(bool enabled, Fn<void(bool)> done) {
|
|||
}
|
||||
} catch (const std::exception &e) {
|
||||
if (done) {
|
||||
LOG(("Portal Autostart Error: %1").arg(
|
||||
QString::fromStdString(e.what())));
|
||||
LOG(("Portal Autostart Error: %1").arg(e.what()));
|
||||
done(false);
|
||||
}
|
||||
}
|
||||
|
@ -174,8 +172,7 @@ void PortalAutostart(bool enabled, Fn<void(bool)> done) {
|
|||
connection->call_finish(result);
|
||||
} catch (const std::exception &e) {
|
||||
if (done) {
|
||||
LOG(("Portal Autostart Error: %1").arg(
|
||||
QString::fromStdString(e.what())));
|
||||
LOG(("Portal Autostart Error: %1").arg(e.what()));
|
||||
done(false);
|
||||
}
|
||||
|
||||
|
@ -286,7 +283,7 @@ bool GenerateDesktopFile(
|
|||
target->save_to_file(targetFile.toStdString());
|
||||
} catch (const std::exception &e) {
|
||||
if (!silent) {
|
||||
LOG(("App Error: %1").arg(QString::fromStdString(e.what())));
|
||||
LOG(("App Error: %1").arg(e.what()));
|
||||
}
|
||||
return false;
|
||||
}
|
||||
|
@ -378,7 +375,7 @@ bool GenerateServiceFile(bool silent = false) {
|
|||
target->save_to_file(targetFile.toStdString());
|
||||
} catch (const std::exception &e) {
|
||||
if (!silent) {
|
||||
LOG(("App Error: %1").arg(QString::fromStdString(e.what())));
|
||||
LOG(("App Error: %1").arg(e.what()));
|
||||
}
|
||||
return false;
|
||||
}
|
||||
|
|
Loading…
Add table
Reference in a new issue