Catch exceptions when launching external editor
Catch all Glib::Errors and print the error code and message to stderr.
This commit is contained in:
parent
02e3e01294
commit
c4a8554db3
@ -342,5 +342,13 @@ bool ExtProgStore::openInCustomEditor (const Glib::ustring& fileName)
|
|||||||
|
|
||||||
bool ExtProgStore::openInExternalEditor(const Glib::ustring &fileName, const Glib::RefPtr<Gio::AppInfo> &editorInfo)
|
bool ExtProgStore::openInExternalEditor(const Glib::ustring &fileName, const Glib::RefPtr<Gio::AppInfo> &editorInfo)
|
||||||
{
|
{
|
||||||
return editorInfo->launch(Gio::File::create_for_path(fileName));
|
try {
|
||||||
|
return editorInfo->launch(Gio::File::create_for_path(fileName));
|
||||||
|
} catch (const Glib::Error &e) {
|
||||||
|
std::cerr
|
||||||
|
<< "Error launching external editor.\n"
|
||||||
|
<< "Error code #" << e.code() << ": " << e.what()
|
||||||
|
<< std::endl;
|
||||||
|
return false;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
Loading…
x
Reference in New Issue
Block a user