diff options
author | Pierre Ossman <ossman@cendio.se> | 2024-11-07 10:37:53 +0100 |
---|---|---|
committer | Pierre Ossman <ossman@cendio.se> | 2024-11-07 10:37:53 +0100 |
commit | f7507aea98b1a428d02fe5c41d25ee69dd5436bb (patch) | |
tree | 49f9349a1d7441874d1cb6d4428e2bcb0d63b422 /vncviewer/vncviewer.cxx | |
parent | 7508e9887de022e127d8fadb9f6a6bd8e9778864 (diff) | |
parent | 2b7857283b834391266e414adcff8c20f8fe3067 (diff) | |
download | tigervnc-f7507aea98b1a428d02fe5c41d25ee69dd5436bb.tar.gz tigervnc-f7507aea98b1a428d02fe5c41d25ee69dd5436bb.zip |
Merge branch 'stdexcept' of github.com:CendioOssman/tigervnc
Diffstat (limited to 'vncviewer/vncviewer.cxx')
-rw-r--r-- | vncviewer/vncviewer.cxx | 31 |
1 files changed, 15 insertions, 16 deletions
diff --git a/vncviewer/vncviewer.cxx b/vncviewer/vncviewer.cxx index a1d9b39d..5acab1a1 100644 --- a/vncviewer/vncviewer.cxx +++ b/vncviewer/vncviewer.cxx @@ -55,7 +55,6 @@ #include <rfb/Hostname.h> #include <rfb/LogWriter.h> #include <rfb/Timer.h> -#include <rfb/Exception.h> #include <rdr/Exception.h> #include <network/TcpSocket.h> #include <os/os.h> @@ -155,9 +154,9 @@ void abort_connection(const char *error, ...) exitMainloop = true; } -void abort_connection_with_unexpected_error(const rdr::Exception &e) { +void abort_connection_with_unexpected_error(const std::exception &e) { abort_connection(_("An unexpected error occurred when communicating " - "with the server:\n\n%s"), e.str()); + "with the server:\n\n%s"), e.what()); } void disconnect() @@ -513,10 +512,10 @@ potentiallyLoadConfigurationFile(const char *filename) // don't try to connect to the filename strncpy(vncServerName, newServerName, VNCSERVERNAMELEN-1); vncServerName[VNCSERVERNAMELEN-1] = '\0'; - } catch (rfb::Exception& e) { - vlog.error("%s", e.str()); + } catch (std::exception& e) { + vlog.error("%s", e.what()); abort_vncviewer(_("Unable to load the specified configuration " - "file:\n\n%s"), e.str()); + "file:\n\n%s"), e.what()); } } } @@ -671,8 +670,8 @@ int main(int argc, char** argv) strncpy(defaultServerName, configServerName, VNCSERVERNAMELEN-1); defaultServerName[VNCSERVERNAMELEN-1] = '\0'; } - } catch (rfb::Exception& e) { - vlog.error("%s", e.str()); + } catch (std::exception& e) { + vlog.error("%s", e.what()); } for (int i = 1; i < argc;) { @@ -757,7 +756,7 @@ int main(int argc, char** argv) createTcpListeners(&listeners, nullptr, port); if (listeners.empty()) - throw Exception(_("Unable to listen for incoming connections")); + throw std::runtime_error(_("Unable to listen for incoming connections")); vlog.info(_("Listening on port %d"), port); @@ -774,7 +773,7 @@ int main(int argc, char** argv) vlog.debug("Interrupted select() system call"); continue; } else { - throw rdr::SocketException("select", errno); + throw rdr::socket_error("select", errno); } } @@ -786,9 +785,9 @@ int main(int argc, char** argv) break; } } - } catch (rdr::Exception& e) { - vlog.error("%s", e.str()); - abort_vncviewer(_("Failure waiting for incoming VNC connection:\n\n%s"), e.str()); + } catch (std::exception& e) { + vlog.error("%s", e.what()); + abort_vncviewer(_("Failure waiting for incoming VNC connection:\n\n%s"), e.what()); return 1; /* Not reached */ } @@ -807,9 +806,9 @@ int main(int argc, char** argv) if (strlen(via) > 0) { try { mktunnel(); - } catch (rdr::Exception& e) { - vlog.error("%s", e.str()); - abort_vncviewer(_("Failure setting up encrypted tunnel:\n\n%s"), e.str()); + } catch (std::exception& e) { + vlog.error("%s", e.what()); + abort_vncviewer(_("Failure setting up encrypted tunnel:\n\n%s"), e.what()); } } #endif |