From 85d89f984670a3f1165f6f5ce321dd91843a412c Mon Sep 17 00:00:00 2001 From: sithlord48 Date: Thu, 7 Aug 2025 17:35:24 -0400 Subject: [PATCH] refactor: XArch Classes => Arch Exception Classes --- src/lib/arch/ArchException.h | 205 ++++++++++++++++++ src/lib/arch/CMakeLists.txt | 2 +- src/lib/arch/IArchDaemon.h | 6 +- src/lib/arch/IArchNetwork.h | 2 +- src/lib/arch/XArch.h | 205 ------------------ src/lib/arch/unix/ArchDaemonUnix.cpp | 4 +- src/lib/arch/unix/ArchMultithreadPosix.cpp | 6 +- src/lib/arch/unix/ArchNetworkBSD.cpp | 40 ++-- src/lib/arch/win32/ArchDaemonWindows.cpp | 38 ++-- src/lib/arch/win32/ArchDaemonWindows.h | 4 +- src/lib/arch/win32/ArchMultithreadWindows.cpp | 6 +- src/lib/arch/win32/ArchNetworkWinsock.cpp | 54 ++--- src/lib/deskflow/win32/AppUtilWindows.cpp | 2 +- src/lib/mt/Thread.cpp | 2 +- src/lib/mt/Thread.h | 10 +- src/lib/mt/ThreadException.h | 6 +- src/lib/net/NetworkAddress.cpp | 10 +- src/lib/net/SecureListenSocket.cpp | 4 +- src/lib/net/SecureSocket.cpp | 4 +- src/lib/net/SocketMultiplexer.cpp | 4 +- src/lib/net/TCPListenSocket.cpp | 12 +- src/lib/net/TCPSocket.cpp | 32 +-- src/lib/platform/EiScreen.cpp | 2 +- src/lib/platform/OSXClipboard.cpp | 4 +- src/lib/platform/OSXScreen.mm | 2 +- src/lib/platform/XWindowsScreen.cpp | 2 +- .../arch/unix/ArchNetworkBSDTests.cpp | 4 +- 27 files changed, 336 insertions(+), 336 deletions(-) create mode 100644 src/lib/arch/ArchException.h delete mode 100644 src/lib/arch/XArch.h diff --git a/src/lib/arch/ArchException.h b/src/lib/arch/ArchException.h new file mode 100644 index 000000000..d245be679 --- /dev/null +++ b/src/lib/arch/ArchException.h @@ -0,0 +1,205 @@ +/* + * Deskflow -- mouse and keyboard sharing utility + * SPDX-FileCopyrightText: (C) 2025 Deskflow Developers + * SPDX-FileCopyrightText: (C) 2012 - 2016 Symless Ltd. + * SPDX-FileCopyrightText: (C) 2002 Chris Schoeneman + * SPDX-License-Identifier: GPL-2.0-only WITH LicenseRef-OpenSSL-Exception + */ + +#pragma once + +#include "common/Common.h" + +#include +#include + +//! Generic thread exception +/*! +Exceptions derived from this class are used by the multithreading +library to perform stack unwinding when a thread terminates. These +exceptions must always be rethrown by clients when caught. +*/ +class ThreadException : public std::exception +{ +}; + +//! Thread exception to cancel +/*! +Thrown to cancel a thread. Clients must not throw this type, but +must rethrow it if caught (by ThreadCancelException, ThreadException, or ...). +*/ +class ThreadCancelException : public ThreadException +{ +}; + +/*! +\def RETHROW_THREADEXCEPTION +Convenience macro to rethrow an ThreadException exception but ignore other +exceptions. Put this in your catch (...) handler after necessary +cleanup but before leaving or returning from the handler. +*/ +#define RETHROW_THREADEXCEPTION \ + try { \ + throw; \ + } catch (ThreadException &) { \ + throw; \ + } catch (...) { \ + } + +//! Generic network exception +/*! +Exceptions derived from this class are used by the networking +library to indicate various errors. +*/ +class ArchNetworkException : public std::runtime_error +{ + using std::runtime_error::runtime_error; +}; + +//! Operation was interrupted +class ArchNetworkInterruptedException : public ArchNetworkException +{ + using ArchNetworkException::ArchNetworkException; +}; + +//! Network insufficient permission +class ArchNetworkAccessException : public ArchNetworkException +{ + using ArchNetworkException::ArchNetworkException; +}; + +//! Network insufficient resources +class ArchNetworkResourceException : public ArchNetworkException +{ + using ArchNetworkException::ArchNetworkException; +}; + +//! No support for requested network resource/service +class ArchNetworkSupportException : public ArchNetworkException +{ + using ArchNetworkException::ArchNetworkException; +}; + +//! Network I/O error +class ArchNetworkIOException : public ArchNetworkException +{ + using ArchNetworkException::ArchNetworkException; +}; + +//! Network address is unavailable or not local +class ArchNetworkNoAddressException : public ArchNetworkException +{ + using ArchNetworkException::ArchNetworkException; +}; + +//! Network address in use +class ArchNetworkAddressInUseException : public ArchNetworkException +{ + using ArchNetworkException::ArchNetworkException; +}; + +//! No route to address +class ArchNetworkNoRouteException : public ArchNetworkException +{ + using ArchNetworkException::ArchNetworkException; +}; + +//! Socket not connected +class ArchNetworkNotConnectedException : public ArchNetworkException +{ + using ArchNetworkException::ArchNetworkException; +}; + +//! Remote read end of socket has closed +class ArchNetworkShutdownException : public ArchNetworkException +{ + using ArchNetworkException::ArchNetworkException; +}; + +//! Remote end of socket has disconnected +class ArchNetworkDisconnectedException : public ArchNetworkException +{ + using ArchNetworkException::ArchNetworkException; +}; + +//! Remote end of socket refused connection +class ArchNetworkConnectionRefusedException : public ArchNetworkException +{ + using ArchNetworkException::ArchNetworkException; +}; + +//! Remote end of socket is not responding +class ArchNetworkTimedOutException : public ArchNetworkException +{ + using ArchNetworkException::ArchNetworkException; +}; + +//! Generic network name lookup erros +class ArchNetworkNameException : public ArchNetworkException +{ + using ArchNetworkException::ArchNetworkException; +}; + +//! The named host is unknown +class ArchNetworkNameUnknownException : public ArchNetworkNameException +{ + using ArchNetworkNameException::ArchNetworkNameException; +}; + +//! The named host is known but has no address +class ArchNetworkNameNoAddressException : public ArchNetworkNameException +{ + using ArchNetworkNameException::ArchNetworkNameException; +}; + +//! Non-recoverable name server error +class ArchNetworkNameFailureException : public ArchNetworkNameException +{ + using ArchNetworkNameException::ArchNetworkNameException; +}; + +//! Temporary name server error +class ArchNetworkNameUnavailableException : public ArchNetworkNameException +{ + using ArchNetworkNameException::ArchNetworkNameException; +}; + +//! The named host is known but no supported address +class ArchNetworkNameUnsupportedException : public ArchNetworkNameException +{ + using ArchNetworkNameException::ArchNetworkNameException; +}; + +//! Generic daemon exception +/*! +Exceptions derived from this class are used by the daemon +library to indicate various errors. +*/ +class ArchDaemonException : public std::runtime_error +{ + using std::runtime_error::runtime_error; +}; + +//! Could not daemonize +class ArchDaemonFailedException : public ArchDaemonException +{ + using ArchDaemonException::ArchDaemonException; +}; + +//! Could not install daemon +class ArchDaemonInstallException : public ArchDaemonException +{ + using ArchDaemonException::ArchDaemonException; +}; + +//! Could not uninstall daemon +class ArchDaemonUninstallFailedException : public ArchDaemonException +{ + using ArchDaemonException::ArchDaemonException; +}; + +//! Attempted to uninstall a daemon that was not installed +class ArchDaemonUninstallNotInstalledException : public ArchDaemonFailedException +{ + using ArchDaemonFailedException::ArchDaemonFailedException; +}; diff --git a/src/lib/arch/CMakeLists.txt b/src/lib/arch/CMakeLists.txt index 0edb5df93..251db4126 100644 --- a/src/lib/arch/CMakeLists.txt +++ b/src/lib/arch/CMakeLists.txt @@ -40,13 +40,13 @@ add_library(arch STATIC ${PLATFORM_CODE} Arch.h ArchDaemonNone.cpp ArchDaemonNone.h + ArchException.h IArchDaemon.h IArchLog.h IArchMultithread.h IArchNetwork.h ArchString.cpp ArchString.h - XArch.h ) if(UNIX) diff --git a/src/lib/arch/IArchDaemon.h b/src/lib/arch/IArchDaemon.h index 881fb3ed7..a4c9cedfa 100644 --- a/src/lib/arch/IArchDaemon.h +++ b/src/lib/arch/IArchDaemon.h @@ -37,7 +37,7 @@ public: start when the current user logs in. If \p dependencies is not nullptr then it's a concatenation of NUL terminated other daemon names followed by a NUL; the daemon will be configured to startup after - the listed daemons. Throws an \c XArchDaemon exception on failure. + the listed daemons. Throws an \c ArchDaemonException exception on failure. */ virtual void installDaemon( const char *name, const char *description, const char *pathname, const char *commandLine, const char *dependencies @@ -45,7 +45,7 @@ public: //! Uninstall daemon /*! - Uninstall a daemon. Throws an \c XArchDaemon on failure. + Uninstall a daemon. Throws an \c ArchDaemonException on failure. */ virtual void uninstallDaemon(const char *name) = 0; @@ -63,7 +63,7 @@ public: //! Daemonize the process /*! - Daemonize. Throw XArchDaemonFailed on error. \c name is the name + Daemonize. Throw ArchDaemonFailedException on error. \c name is the name of the daemon. Once daemonized, \c func is invoked and daemonize returns when and what it does. diff --git a/src/lib/arch/IArchNetwork.h b/src/lib/arch/IArchNetwork.h index d3d45cdb3..265463a22 100644 --- a/src/lib/arch/IArchNetwork.h +++ b/src/lib/arch/IArchNetwork.h @@ -213,7 +213,7 @@ public: //! Check error on socket /*! If the socket \c s is in an error state then throws an appropriate - XArchNetwork exception. + ArchNetworkException exception. */ virtual void throwErrorOnSocket(ArchSocket s) = 0; diff --git a/src/lib/arch/XArch.h b/src/lib/arch/XArch.h deleted file mode 100644 index 954cae1b5..000000000 --- a/src/lib/arch/XArch.h +++ /dev/null @@ -1,205 +0,0 @@ -/* - * Deskflow -- mouse and keyboard sharing utility - * SPDX-FileCopyrightText: (C) 2025 Deskflow Developers - * SPDX-FileCopyrightText: (C) 2012 - 2016 Symless Ltd. - * SPDX-FileCopyrightText: (C) 2002 Chris Schoeneman - * SPDX-License-Identifier: GPL-2.0-only WITH LicenseRef-OpenSSL-Exception - */ - -#pragma once - -#include "common/Common.h" - -#include -#include - -//! Generic thread exception -/*! -Exceptions derived from this class are used by the multithreading -library to perform stack unwinding when a thread terminates. These -exceptions must always be rethrown by clients when caught. -*/ -class XThread : public std::exception -{ -}; - -//! Thread exception to cancel -/*! -Thrown to cancel a thread. Clients must not throw this type, but -must rethrow it if caught (by XThreadCancel, XThread, or ...). -*/ -class XThreadCancel : public XThread -{ -}; - -/*! -\def RETHROW_XTHREAD -Convenience macro to rethrow an XThread exception but ignore other -exceptions. Put this in your catch (...) handler after necessary -cleanup but before leaving or returning from the handler. -*/ -#define RETHROW_XTHREAD \ - try { \ - throw; \ - } catch (XThread &) { \ - throw; \ - } catch (...) { \ - } - -//! Generic network exception -/*! -Exceptions derived from this class are used by the networking -library to indicate various errors. -*/ -class XArchNetwork : public std::runtime_error -{ - using std::runtime_error::runtime_error; -}; - -//! Operation was interrupted -class XArchNetworkInterrupted : public XArchNetwork -{ - using XArchNetwork::XArchNetwork; -}; - -//! Network insufficient permission -class XArchNetworkAccess : public XArchNetwork -{ - using XArchNetwork::XArchNetwork; -}; - -//! Network insufficient resources -class XArchNetworkResource : public XArchNetwork -{ - using XArchNetwork::XArchNetwork; -}; - -//! No support for requested network resource/service -class XArchNetworkSupport : public XArchNetwork -{ - using XArchNetwork::XArchNetwork; -}; - -//! Network I/O error -class XArchNetworkIO : public XArchNetwork -{ - using XArchNetwork::XArchNetwork; -}; - -//! Network address is unavailable or not local -class XArchNetworkNoAddress : public XArchNetwork -{ - using XArchNetwork::XArchNetwork; -}; - -//! Network address in use -class XArchNetworkAddressInUse : public XArchNetwork -{ - using XArchNetwork::XArchNetwork; -}; - -//! No route to address -class XArchNetworkNoRoute : public XArchNetwork -{ - using XArchNetwork::XArchNetwork; -}; - -//! Socket not connected -class XArchNetworkNotConnected : public XArchNetwork -{ - using XArchNetwork::XArchNetwork; -}; - -//! Remote read end of socket has closed -class XArchNetworkShutdown : public XArchNetwork -{ - using XArchNetwork::XArchNetwork; -}; - -//! Remote end of socket has disconnected -class XArchNetworkDisconnected : public XArchNetwork -{ - using XArchNetwork::XArchNetwork; -}; - -//! Remote end of socket refused connection -class XArchNetworkConnectionRefused : public XArchNetwork -{ - using XArchNetwork::XArchNetwork; -}; - -//! Remote end of socket is not responding -class XArchNetworkTimedOut : public XArchNetwork -{ - using XArchNetwork::XArchNetwork; -}; - -//! Generic network name lookup erros -class XArchNetworkName : public XArchNetwork -{ - using XArchNetwork::XArchNetwork; -}; - -//! The named host is unknown -class XArchNetworkNameUnknown : public XArchNetworkName -{ - using XArchNetworkName::XArchNetworkName; -}; - -//! The named host is known but has no address -class XArchNetworkNameNoAddress : public XArchNetworkName -{ - using XArchNetworkName::XArchNetworkName; -}; - -//! Non-recoverable name server error -class XArchNetworkNameFailure : public XArchNetworkName -{ - using XArchNetworkName::XArchNetworkName; -}; - -//! Temporary name server error -class XArchNetworkNameUnavailable : public XArchNetworkName -{ - using XArchNetworkName::XArchNetworkName; -}; - -//! The named host is known but no supported address -class XArchNetworkNameUnsupported : public XArchNetworkName -{ - using XArchNetworkName::XArchNetworkName; -}; - -//! Generic daemon exception -/*! -Exceptions derived from this class are used by the daemon -library to indicate various errors. -*/ -class XArchDaemon : public std::runtime_error -{ - using std::runtime_error::runtime_error; -}; - -//! Could not daemonize -class XArchDaemonFailed : public XArchDaemon -{ - using XArchDaemon::XArchDaemon; -}; - -//! Could not install daemon -class XArchDaemonInstallFailed : public XArchDaemon -{ - using XArchDaemon::XArchDaemon; -}; - -//! Could not uninstall daemon -class XArchDaemonUninstallFailed : public XArchDaemon -{ - using XArchDaemon::XArchDaemon; -}; - -//! Attempted to uninstall a daemon that was not installed -class XArchDaemonUninstallNotInstalled : public XArchDaemonFailed -{ - using XArchDaemonFailed::XArchDaemonFailed; -}; diff --git a/src/lib/arch/unix/ArchDaemonUnix.cpp b/src/lib/arch/unix/ArchDaemonUnix.cpp index f69e25dd4..2947f40db 100644 --- a/src/lib/arch/unix/ArchDaemonUnix.cpp +++ b/src/lib/arch/unix/ArchDaemonUnix.cpp @@ -8,7 +8,7 @@ #include "arch/unix/ArchDaemonUnix.h" -#include "arch/XArch.h" +#include "arch/ArchException.h" #include "arch/unix/XArchUnix.h" #include "base/Log.h" @@ -58,7 +58,7 @@ int ArchDaemonUnix::daemonize(const char *name, DaemonFunc const &func) switch (fork()) { case -1: // failed - throw XArchDaemonFailed(errorToString(errno)); + throw ArchDaemonFailedException(errorToString(errno)); case 0: // child diff --git a/src/lib/arch/unix/ArchMultithreadPosix.cpp b/src/lib/arch/unix/ArchMultithreadPosix.cpp index 0532d499f..e4b4c340a 100644 --- a/src/lib/arch/unix/ArchMultithreadPosix.cpp +++ b/src/lib/arch/unix/ArchMultithreadPosix.cpp @@ -8,7 +8,7 @@ #include "arch/unix/ArchMultithreadPosix.h" #include "arch/Arch.h" -#include "arch/XArch.h" +#include "arch/ArchException.h" #include #include @@ -584,7 +584,7 @@ void ArchMultithreadPosix::testCancelThreadImpl(ArchThreadImpl *thread) // unwind thread's stack if cancelling if (cancel) { - throw XThreadCancel(); + throw ThreadCancelException(); } } @@ -620,7 +620,7 @@ void ArchMultithreadPosix::doThreadFunc(ArchThread thread) result = (*thread->m_func)(thread->m_userData); } - catch (XThreadCancel &) { + catch (ThreadCancelException &) { // client called cancel() // set base value result = nullptr; diff --git a/src/lib/arch/unix/ArchNetworkBSD.cpp b/src/lib/arch/unix/ArchNetworkBSD.cpp index 5965423fc..0377c9b3d 100644 --- a/src/lib/arch/unix/ArchNetworkBSD.cpp +++ b/src/lib/arch/unix/ArchNetworkBSD.cpp @@ -8,7 +8,7 @@ #include "arch/unix/ArchNetworkBSD.h" #include "arch/Arch.h" -#include "arch/XArch.h" +#include "arch/ArchException.h" #include "arch/unix/ArchMultithreadPosix.h" #include "arch/unix/XArchUnix.h" @@ -745,11 +745,11 @@ const int *ArchNetworkBSD::getUnblockPipeForThread(ArchThread thread) switch (err) { case EINTR: ARCH->testCancelThread(); - throw XArchNetworkInterrupted(errorToString(err)); + throw ArchNetworkInterruptedException(errorToString(err)); case EACCES: case EPERM: - throw XArchNetworkAccess(errorToString(err)); + throw ArchNetworkAccessException(errorToString(err)); case ENFILE: case EMFILE: @@ -760,7 +760,7 @@ const int *ArchNetworkBSD::getUnblockPipeForThread(ArchThread thread) #if defined(ENOSR) case ENOSR: #endif - throw XArchNetworkResource(errorToString(err)); + throw ArchNetworkResourceException(errorToString(err)); case EPROTOTYPE: case EPROTONOSUPPORT: @@ -774,40 +774,40 @@ const int *ArchNetworkBSD::getUnblockPipeForThread(ArchThread thread) #if defined(ENOPKG) case ENOPKG: #endif - throw XArchNetworkSupport(errorToString(err)); + throw ArchNetworkSupportException(errorToString(err)); case EIO: - throw XArchNetworkIO(errorToString(err)); + throw ArchNetworkIOException(errorToString(err)); case EADDRNOTAVAIL: - throw XArchNetworkNoAddress(errorToString(err)); + throw ArchNetworkNoAddressException(errorToString(err)); case EADDRINUSE: - throw XArchNetworkAddressInUse(errorToString(err)); + throw ArchNetworkAddressInUseException(errorToString(err)); case EHOSTUNREACH: case ENETUNREACH: - throw XArchNetworkNoRoute(errorToString(err)); + throw ArchNetworkNoRouteException(errorToString(err)); case ENOTCONN: - throw XArchNetworkNotConnected(errorToString(err)); + throw ArchNetworkNotConnectedException(errorToString(err)); case EPIPE: - throw XArchNetworkShutdown(errorToString(err)); + throw ArchNetworkShutdownException(errorToString(err)); case ECONNABORTED: case ECONNRESET: - throw XArchNetworkDisconnected(errorToString(err)); + throw ArchNetworkDisconnectedException(errorToString(err)); case ECONNREFUSED: - throw XArchNetworkConnectionRefused(errorToString(err)); + throw ArchNetworkConnectionRefusedException(errorToString(err)); case EHOSTDOWN: case ETIMEDOUT: - throw XArchNetworkTimedOut(errorToString(err)); + throw ArchNetworkTimedOutException(errorToString(err)); default: - throw XArchNetwork(errorToString(err)); + throw ArchNetworkException(errorToString(err)); } } @@ -821,18 +821,18 @@ const int *ArchNetworkBSD::getUnblockPipeForThread(ArchThread thread) switch (err) { case HOST_NOT_FOUND: - throw XArchNetworkNameUnknown(s_msg[0]); + throw ArchNetworkNameUnknownException(s_msg[0]); case NO_DATA: - throw XArchNetworkNameNoAddress(s_msg[1]); + throw ArchNetworkNameNoAddressException(s_msg[1]); case NO_RECOVERY: - throw XArchNetworkNameFailure(s_msg[2]); + throw ArchNetworkNameFailureException(s_msg[2]); case TRY_AGAIN: - throw XArchNetworkNameUnavailable(s_msg[3]); + throw ArchNetworkNameUnavailableException(s_msg[3]); default: - throw XArchNetworkName(s_msg[4]); + throw ArchNetworkNameException(s_msg[4]); } } diff --git a/src/lib/arch/win32/ArchDaemonWindows.cpp b/src/lib/arch/win32/ArchDaemonWindows.cpp index 090d8f4fe..6d3d63e85 100644 --- a/src/lib/arch/win32/ArchDaemonWindows.cpp +++ b/src/lib/arch/win32/ArchDaemonWindows.cpp @@ -8,7 +8,7 @@ #include "arch/win32/ArchDaemonWindows.h" #include "arch/Arch.h" -#include "arch/XArch.h" +#include "arch/ArchException.h" #include "arch/win32/ArchMiscWindows.h" #include "arch/win32/XArchWindows.h" #include "base/Log.h" @@ -51,7 +51,7 @@ UINT ArchDaemonWindows::getDaemonQuitMessage() void ArchDaemonWindows::daemonFailed(int result) { assert(s_daemon != nullptr); - throw XArchDaemonRunFailed(result); + throw ArchDaemonRunException(result); } void ArchDaemonWindows::installDaemon( @@ -64,7 +64,7 @@ void ArchDaemonWindows::installDaemon( SC_HANDLE mgr = OpenSCManager(nullptr, nullptr, GENERIC_WRITE); if (mgr == nullptr) { // can't open service manager - throw XArchDaemonInstallFailed(windowsErrorToString(GetLastError())); + throw ArchDaemonInstallException(windowsErrorToString(GetLastError())); } // create the service @@ -78,7 +78,7 @@ void ArchDaemonWindows::installDaemon( DWORD err = GetLastError(); if (err != ERROR_SERVICE_EXISTS) { CloseServiceHandle(mgr); - throw XArchDaemonInstallFailed(windowsErrorToString(err)); + throw ArchDaemonInstallException(windowsErrorToString(err)); } } else { // done with service (but only try to close if not null) @@ -99,7 +99,7 @@ void ArchDaemonWindows::installDaemon( } catch (...) { // ignore } - throw XArchDaemonInstallFailed(windowsErrorToString(err)); + throw ArchDaemonInstallException(windowsErrorToString(err)); } // set the description @@ -116,7 +116,7 @@ void ArchDaemonWindows::installDaemon( } catch (...) { // ignore } - throw XArchDaemonInstallFailed(windowsErrorToString(err)); + throw ArchDaemonInstallException(windowsErrorToString(err)); } ArchMiscWindows::setValue(key, _T("CommandLine"), commandLine); @@ -140,7 +140,7 @@ void ArchDaemonWindows::uninstallDaemon(const char *name) SC_HANDLE mgr = OpenSCManager(nullptr, nullptr, GENERIC_WRITE); if (mgr == nullptr) { // can't open service manager - throw XArchDaemonUninstallFailed(windowsErrorToString(GetLastError())); + throw ArchDaemonUninstallFailedException(windowsErrorToString(GetLastError())); } // open the service. oddly, you must open a service to delete it. @@ -149,9 +149,9 @@ void ArchDaemonWindows::uninstallDaemon(const char *name) DWORD err = GetLastError(); CloseServiceHandle(mgr); if (err != ERROR_SERVICE_DOES_NOT_EXIST) { - throw XArchDaemonUninstallFailed(windowsErrorToString(err)); + throw ArchDaemonUninstallFailedException(windowsErrorToString(err)); } - throw XArchDaemonUninstallNotInstalled(windowsErrorToString(err)); + throw ArchDaemonUninstallNotInstalledException(windowsErrorToString(err)); } // stop the service. we don't care if we fail. @@ -184,9 +184,9 @@ void ArchDaemonWindows::uninstallDaemon(const char *name) return; } if (err != ERROR_SERVICE_MARKED_FOR_DELETE) { - throw XArchDaemonUninstallFailed(windowsErrorToString(err)); + throw ArchDaemonUninstallFailedException(windowsErrorToString(err)); } - throw XArchDaemonUninstallNotInstalled(windowsErrorToString(err)); + throw ArchDaemonUninstallNotInstalledException(windowsErrorToString(err)); } } @@ -211,7 +211,7 @@ int ArchDaemonWindows::daemonize(const char *name, DaemonFunc const &func) if (StartServiceCtrlDispatcher(entry) == 0) { // StartServiceCtrlDispatcher failed s_daemon = nullptr; - throw XArchDaemonFailed(windowsErrorToString(GetLastError())); + throw ArchDaemonFailedException(windowsErrorToString(GetLastError())); } s_daemon = nullptr; @@ -472,7 +472,7 @@ void ArchDaemonWindows::serviceMain(DWORD argc, LPTSTR *argvIn) try { // invoke daemon function m_daemonResult = m_daemonFunc(static_cast(argc), argv); - } catch (XArchDaemonRunFailed &e) { + } catch (ArchDaemonRunException &e) { setStatusError(e.m_result); m_daemonResult = -1; } catch (...) { @@ -560,7 +560,7 @@ void ArchDaemonWindows::start(const char *name) // open service manager SC_HANDLE mgr = OpenSCManager(nullptr, nullptr, GENERIC_READ); if (mgr == nullptr) { - throw XArchDaemonFailed(windowsErrorToString(GetLastError())); + throw ArchDaemonFailedException(windowsErrorToString(GetLastError())); } // open the service @@ -568,12 +568,12 @@ void ArchDaemonWindows::start(const char *name) if (service == nullptr) { CloseServiceHandle(mgr); - throw XArchDaemonFailed(windowsErrorToString(GetLastError())); + throw ArchDaemonFailedException(windowsErrorToString(GetLastError())); } // start the service if (!StartService(service, 0, nullptr)) { - throw XArchDaemonFailed(windowsErrorToString(GetLastError())); + throw ArchDaemonFailedException(windowsErrorToString(GetLastError())); } } @@ -582,7 +582,7 @@ void ArchDaemonWindows::stop(const char *name) // open service manager SC_HANDLE mgr = OpenSCManager(nullptr, nullptr, GENERIC_READ); if (mgr == nullptr) { - throw XArchDaemonFailed(windowsErrorToString(GetLastError())); + throw ArchDaemonFailedException(windowsErrorToString(GetLastError())); } // open the service @@ -590,7 +590,7 @@ void ArchDaemonWindows::stop(const char *name) if (service == nullptr) { CloseServiceHandle(mgr); - throw XArchDaemonFailed(windowsErrorToString(GetLastError())); + throw ArchDaemonFailedException(windowsErrorToString(GetLastError())); } // ask the service to stop, asynchronously @@ -598,7 +598,7 @@ void ArchDaemonWindows::stop(const char *name) if (!ControlService(service, SERVICE_CONTROL_STOP, &ss)) { DWORD dwErrCode = GetLastError(); if (dwErrCode != ERROR_SERVICE_NOT_ACTIVE) { - throw XArchDaemonFailed(windowsErrorToString(GetLastError())); + throw ArchDaemonFailedException(windowsErrorToString(GetLastError())); } } } diff --git a/src/lib/arch/win32/ArchDaemonWindows.h b/src/lib/arch/win32/ArchDaemonWindows.h index d03e15fda..78a29ed96 100644 --- a/src/lib/arch/win32/ArchDaemonWindows.h +++ b/src/lib/arch/win32/ArchDaemonWindows.h @@ -104,10 +104,10 @@ private: void stop(const char *name); private: - class XArchDaemonRunFailed + class ArchDaemonRunException { public: - XArchDaemonRunFailed(int result) : m_result(result) + ArchDaemonRunException(int result) : m_result(result) { } diff --git a/src/lib/arch/win32/ArchMultithreadWindows.cpp b/src/lib/arch/win32/ArchMultithreadWindows.cpp index 9067d6aec..eec29773d 100644 --- a/src/lib/arch/win32/ArchMultithreadWindows.cpp +++ b/src/lib/arch/win32/ArchMultithreadWindows.cpp @@ -11,7 +11,7 @@ #include "arch/win32/ArchMultithreadWindows.h" #include "arch/Arch.h" -#include "arch/XArch.h" +#include "arch/ArchException.h" #include @@ -577,7 +577,7 @@ void ArchMultithreadWindows::testCancelThreadImpl(ArchThreadImpl *thread) // unwind thread's stack if cancelling if (cancel) { - throw XThreadCancel(); + throw ThreadCancelException(); } } @@ -606,7 +606,7 @@ void ArchMultithreadWindows::doThreadFunc(ArchThread thread) result = (*thread->m_func)(thread->m_userData); } - catch (XThreadCancel &) { + catch (ThreadCancelException &) { // client called cancel() } catch (...) { // note -- don't catch (...) to avoid masking bugs diff --git a/src/lib/arch/win32/ArchNetworkWinsock.cpp b/src/lib/arch/win32/ArchNetworkWinsock.cpp index a1f9fea8e..2ed1084b0 100644 --- a/src/lib/arch/win32/ArchNetworkWinsock.cpp +++ b/src/lib/arch/win32/ArchNetworkWinsock.cpp @@ -7,8 +7,8 @@ #include "arch/win32/ArchNetworkWinsock.h" #include "arch/Arch.h" +#include "arch/ArchException.h" #include "arch/IArchMultithread.h" -#include "arch/XArch.h" #include "arch/win32/ArchMultithreadWindows.h" #include "arch/win32/XArchWindows.h" @@ -65,7 +65,7 @@ static FARPROC netGetProcAddress(HMODULE module, LPCSTR name) { FARPROC func = ::GetProcAddress(module, name); if (!func) { - throw XArchNetworkSupport(""); + throw ArchNetworkSupportException(""); } return func; } @@ -110,19 +110,19 @@ void ArchNetworkWinsock::init() try { initModule((HMODULE)::LoadLibrary(s_library[i])); return; - } catch (XArchNetwork &) { + } catch (ArchNetworkException &) { // ignore } } // can't initialize any library - throw XArchNetworkSupport("Cannot load winsock library"); + throw ArchNetworkSupportException("Cannot load winsock library"); } void ArchNetworkWinsock::initModule(HMODULE module) { if (module == nullptr) { - throw XArchNetworkSupport(""); + throw ArchNetworkSupportException(""); } // get startup function address @@ -134,7 +134,7 @@ void ArchNetworkWinsock::initModule(HMODULE module) WSADATA data; int err = startup(version, &data); if (data.wVersion != version) { - throw XArchNetworkSupport(winsockErrorToString(err)); + throw ArchNetworkSupportException(winsockErrorToString(err)); } if (err != 0) { // some other initialization error @@ -844,12 +844,12 @@ bool ArchNetworkWinsock::isEqualAddr(ArchNetAddress a, ArchNetAddress b) { switch (err) { case WSAEACCES: - throw XArchNetworkAccess(winsockErrorToString(err)); + throw ArchNetworkAccessException(winsockErrorToString(err)); case WSAEMFILE: case WSAENOBUFS: case WSAENETDOWN: - throw XArchNetworkResource(winsockErrorToString(err)); + throw ArchNetworkResourceException(winsockErrorToString(err)); case WSAEPROTOTYPE: case WSAEPROTONOSUPPORT: @@ -863,50 +863,50 @@ bool ArchNetworkWinsock::isEqualAddr(ArchNetAddress a, ArchNetAddress b) case WSANOTINITIALISED: case WSAVERNOTSUPPORTED: case WSASYSNOTREADY: - throw XArchNetworkSupport(winsockErrorToString(err)); + throw ArchNetworkSupportException(winsockErrorToString(err)); case WSAEADDRNOTAVAIL: - throw XArchNetworkNoAddress(winsockErrorToString(err)); + throw ArchNetworkNoAddressException(winsockErrorToString(err)); case WSAEADDRINUSE: - throw XArchNetworkAddressInUse(winsockErrorToString(err)); + throw ArchNetworkAddressInUseException(winsockErrorToString(err)); case WSAEHOSTUNREACH: case WSAENETUNREACH: - throw XArchNetworkNoRoute(winsockErrorToString(err)); + throw ArchNetworkNoRouteException(winsockErrorToString(err)); case WSAENOTCONN: - throw XArchNetworkNotConnected(winsockErrorToString(err)); + throw ArchNetworkNotConnectedException(winsockErrorToString(err)); case WSAEDISCON: - throw XArchNetworkShutdown(winsockErrorToString(err)); + throw ArchNetworkShutdownException(winsockErrorToString(err)); case WSAENETRESET: case WSAECONNABORTED: case WSAECONNRESET: - throw XArchNetworkDisconnected(winsockErrorToString(err)); + throw ArchNetworkDisconnectedException(winsockErrorToString(err)); case WSAECONNREFUSED: - throw XArchNetworkConnectionRefused(winsockErrorToString(err)); + throw ArchNetworkConnectionRefusedException(winsockErrorToString(err)); case WSAEHOSTDOWN: case WSAETIMEDOUT: - throw XArchNetworkTimedOut(winsockErrorToString(err)); + throw ArchNetworkTimedOutException(winsockErrorToString(err)); case WSAHOST_NOT_FOUND: - throw XArchNetworkNameUnknown(winsockErrorToString(err)); + throw ArchNetworkNameUnknownException(winsockErrorToString(err)); case WSANO_DATA: - throw XArchNetworkNameNoAddress(winsockErrorToString(err)); + throw ArchNetworkNameNoAddressException(winsockErrorToString(err)); case WSANO_RECOVERY: - throw XArchNetworkNameFailure(winsockErrorToString(err)); + throw ArchNetworkNameFailureException(winsockErrorToString(err)); case WSATRY_AGAIN: - throw XArchNetworkNameUnavailable(winsockErrorToString(err)); + throw ArchNetworkNameUnavailableException(winsockErrorToString(err)); default: - throw XArchNetwork(winsockErrorToString(err)); + throw ArchNetworkException(winsockErrorToString(err)); } } @@ -914,18 +914,18 @@ bool ArchNetworkWinsock::isEqualAddr(ArchNetAddress a, ArchNetAddress b) { switch (err) { case WSAHOST_NOT_FOUND: - throw XArchNetworkNameUnknown(winsockErrorToString(err)); + throw ArchNetworkNameUnknownException(winsockErrorToString(err)); case WSANO_DATA: - throw XArchNetworkNameNoAddress(winsockErrorToString(err)); + throw ArchNetworkNameNoAddressException(winsockErrorToString(err)); case WSANO_RECOVERY: - throw XArchNetworkNameFailure(winsockErrorToString(err)); + throw ArchNetworkNameFailureException(winsockErrorToString(err)); case WSATRY_AGAIN: - throw XArchNetworkNameUnavailable(winsockErrorToString(err)); + throw ArchNetworkNameUnavailableException(winsockErrorToString(err)); default: - throw XArchNetworkName(winsockErrorToString(err)); + throw ArchNetworkNameException(winsockErrorToString(err)); } } diff --git a/src/lib/deskflow/win32/AppUtilWindows.cpp b/src/lib/deskflow/win32/AppUtilWindows.cpp index 6d92414a1..dbb12b27d 100644 --- a/src/lib/deskflow/win32/AppUtilWindows.cpp +++ b/src/lib/deskflow/win32/AppUtilWindows.cpp @@ -7,7 +7,7 @@ #include "deskflow/win32/AppUtilWindows.h" -#include "arch/XArch.h" +#include "arch/ArchException.h" #include "arch/win32/ArchMiscWindows.h" #include "arch/win32/XArchWindows.h" #include "base/Event.h" diff --git a/src/lib/mt/Thread.cpp b/src/lib/mt/Thread.cpp index c52001281..702b80fdb 100644 --- a/src/lib/mt/Thread.cpp +++ b/src/lib/mt/Thread.cpp @@ -128,7 +128,7 @@ void *Thread::threadFunc(void *vjob) LOG_DEBUG1("thread 0x%08x entry", id); job->run(); LOG_DEBUG1("thread 0x%08x exit", id); - } catch (XThreadCancel &) { + } catch (ThreadCancelException &) { // client called cancel() LOG_DEBUG1("caught cancel on thread 0x%08x", id); delete job; diff --git a/src/lib/mt/Thread.h b/src/lib/mt/Thread.h index 5429ea1a3..24327d510 100644 --- a/src/lib/mt/Thread.h +++ b/src/lib/mt/Thread.h @@ -76,7 +76,7 @@ public: \code catch(ThreadExit&) { throw; } \endcode - or add the \c RETHROW_XTHREAD macro to the \c catch(...) block. + or add the \c RETHROW_THREADEXCEPTION macro to the \c catch(...) block. */ [[noreturn]] static void exit(void *); @@ -94,17 +94,17 @@ public: Instead, it unwinds the stack and destroys automatic objects, as if cancel() threw an exception (which is, in fact, what it does). Threads must take care to unlock and clean up any resources they - may have, especially mutexes. They can \c catch(XThreadCancel) to + may have, especially mutexes. They can \c catch(ThreadCancelException) to do that then rethrow the exception or they can let it happen automatically by doing clean up in the d'tors of automatic objects (like Lock). Clients are strongly encouraged to do the latter. During cancellation, further cancel() calls are ignored (i.e. a thread cannot be interrupted by a cancel during cancellation). - Clients that \c catch(XThreadCancel) must always rethrow the + Clients that \c catch(ThreadCancelException) must always rethrow the exception. Clients that \c catch(...) must either rethrow the - exception or include a \c catch(XThreadCancel) handler that - rethrows. The \c RETHROW_XTHREAD macro may be useful for that. + exception or include a \c catch(ThreadCancelException) handler that + rethrows. The \c RETHROW_THREADEXCEPTION macro may be useful for that. */ void cancel(); diff --git a/src/lib/mt/ThreadException.h b/src/lib/mt/ThreadException.h index d64ac55ce..b79bae851 100644 --- a/src/lib/mt/ThreadException.h +++ b/src/lib/mt/ThreadException.h @@ -8,15 +8,15 @@ #pragma once -#include "arch/XArch.h" +#include "arch/ArchException.h" //! Thread exception to exit /*! Thrown by Thread::exit() to exit a thread. Clients of Thread must not throw this type but must rethrow it if caught (by -ThreadExitException, XThread, or ...). +ThreadExitException, ThreadException, or ...). */ -class ThreadExitException : public XThread +class ThreadExitException : public ThreadException { public: //! \c result is the result of the thread diff --git a/src/lib/net/NetworkAddress.cpp b/src/lib/net/NetworkAddress.cpp index 48c189e20..e7bfc8fae 100644 --- a/src/lib/net/NetworkAddress.cpp +++ b/src/lib/net/NetworkAddress.cpp @@ -8,7 +8,7 @@ #include "net/NetworkAddress.h" #include "arch/Arch.h" -#include "arch/XArch.h" +#include "arch/ArchException.h" #include "net/SocketException.h" #include @@ -155,13 +155,13 @@ size_t NetworkAddress::resolve(size_t index) } } } - } catch (XArchNetworkNameUnknown &) { + } catch (ArchNetworkNameUnknownException &) { throw SocketAddressException(SocketAddressException::SocketError::NotFound, m_hostname, m_port); - } catch (XArchNetworkNameNoAddress &) { + } catch (ArchNetworkNameNoAddressException &) { throw SocketAddressException(SocketAddressException::SocketError::NoAddress, m_hostname, m_port); - } catch (XArchNetworkNameUnsupported &) { + } catch (ArchNetworkNameUnsupportedException &) { throw SocketAddressException(SocketAddressException::SocketError::Unsupported, m_hostname, m_port); - } catch (XArchNetworkName &) { + } catch (ArchNetworkNameException &) { throw SocketAddressException(SocketAddressException::SocketError::Unknown, m_hostname, m_port); } diff --git a/src/lib/net/SecureListenSocket.cpp b/src/lib/net/SecureListenSocket.cpp index 8cccab94f..d15dcf133 100644 --- a/src/lib/net/SecureListenSocket.cpp +++ b/src/lib/net/SecureListenSocket.cpp @@ -8,7 +8,7 @@ #include "SecureListenSocket.h" #include "SecureSocket.h" -#include "arch/XArch.h" +#include "arch/ArchException.h" #include "base/String.h" #include "common/Settings.h" #include "deskflow/ArgParser.h" @@ -58,7 +58,7 @@ std::unique_ptr SecureListenSocket::accept() secureSocket->secureAccept(); return secureSocket; - } catch (XArchNetwork &) { + } catch (ArchNetworkException &) { if (secureSocket) { setListeningJob(); } diff --git a/src/lib/net/SecureSocket.cpp b/src/lib/net/SecureSocket.cpp index 50881c5bc..861adc7af 100644 --- a/src/lib/net/SecureSocket.cpp +++ b/src/lib/net/SecureSocket.cpp @@ -8,7 +8,7 @@ #include "SecureSocket.h" #include "SecureUtils.h" -#include "arch/XArch.h" +#include "arch/ArchException.h" #include "base/Log.h" #include "base/Path.h" #include "base/String.h" @@ -589,7 +589,7 @@ void SecureSocket::checkResult(int status, int &retry) // underlying socket I/O reproted an error try { ARCH->throwErrorOnSocket(getSocket()); - } catch (XArchNetwork &e) { + } catch (ArchNetworkException &e) { LOG_ERR("%s", e.what()); } } diff --git a/src/lib/net/SocketMultiplexer.cpp b/src/lib/net/SocketMultiplexer.cpp index 0c07d8432..ce763aaf2 100644 --- a/src/lib/net/SocketMultiplexer.cpp +++ b/src/lib/net/SocketMultiplexer.cpp @@ -8,7 +8,7 @@ #include "net/SocketMultiplexer.h" #include "arch/Arch.h" -#include "arch/XArch.h" +#include "arch/ArchException.h" #include "base/Log.h" #include "base/TMethodJob.h" #include "mt/CondVar.h" @@ -173,7 +173,7 @@ void SocketMultiplexer::removeSocket(ISocket *socket) } else { status = 0; } - } catch (XArchNetwork &e) { + } catch (ArchNetworkException &e) { LOG_WARN("error in socket multiplexer: %s", e.what()); status = 0; } diff --git a/src/lib/net/TCPListenSocket.cpp b/src/lib/net/TCPListenSocket.cpp index dac3a68a0..240e4e7a9 100644 --- a/src/lib/net/TCPListenSocket.cpp +++ b/src/lib/net/TCPListenSocket.cpp @@ -8,7 +8,7 @@ #include "net/TCPListenSocket.h" #include "arch/Arch.h" -#include "arch/XArch.h" +#include "arch/ArchException.h" #include "base/IEventQueue.h" #include "base/Log.h" #include "io/IOException.h" @@ -30,7 +30,7 @@ TCPListenSocket::TCPListenSocket( { try { m_socket = ARCH->newSocket(family, IArchNetwork::SocketType::Stream); - } catch (XArchNetwork &e) { + } catch (ArchNetworkException &e) { throw SocketCreateException(e.what()); } } @@ -60,9 +60,9 @@ void TCPListenSocket::bind(const NetworkAddress &addr) this, &TCPListenSocket::serviceListening, m_socket, true, false ) ); - } catch (XArchNetworkAddressInUse &e) { + } catch (ArchNetworkAddressInUseException &e) { throw SocketAddressInUseException(e.what()); - } catch (XArchNetwork &e) { + } catch (ArchNetworkException &e) { throw SocketBindException(e.what()); } } @@ -77,7 +77,7 @@ void TCPListenSocket::close() m_socketMultiplexer->removeSocket(this); ARCH->closeSocket(m_socket); m_socket = nullptr; - } catch (XArchNetwork &e) { + } catch (ArchNetworkException &e) { throw SocketIOCloseException(e.what()); } } @@ -94,7 +94,7 @@ std::unique_ptr TCPListenSocket::accept() socket = std::make_unique(m_events, m_socketMultiplexer, ARCH->acceptSocket(m_socket, nullptr)); setListeningJob(); return socket; - } catch (XArchNetwork &) { + } catch (ArchNetworkException &) { if (socket) { setListeningJob(); } diff --git a/src/lib/net/TCPSocket.cpp b/src/lib/net/TCPSocket.cpp index 2444a8966..1250c44eb 100644 --- a/src/lib/net/TCPSocket.cpp +++ b/src/lib/net/TCPSocket.cpp @@ -8,7 +8,7 @@ #include "net/TCPSocket.h" #include "arch/Arch.h" -#include "arch/XArch.h" +#include "arch/ArchException.h" #include "base/IEventQueue.h" #include "base/Log.h" #include "mt/Lock.h" @@ -35,7 +35,7 @@ TCPSocket::TCPSocket(IEventQueue *events, SocketMultiplexer *socketMultiplexer, { try { m_socket = ARCH->newSocket(family, IArchNetwork::SocketType::Stream); - } catch (const XArchNetwork &e) { + } catch (const ArchNetworkException &e) { throw SocketCreateException(e.what()); } @@ -75,9 +75,9 @@ void TCPSocket::bind(const NetworkAddress &addr) { try { ARCH->bindSocket(m_socket, addr.getAddress()); - } catch (const XArchNetworkAddressInUse &e) { + } catch (const ArchNetworkAddressInUseException &e) { throw SocketAddressInUseException(e.what()); - } catch (const XArchNetwork &e) { + } catch (const ArchNetworkException &e) { throw SocketBindException(e.what()); } } @@ -103,7 +103,7 @@ void TCPSocket::close() m_socket = nullptr; try { ARCH->closeSocket(socket); - } catch (const XArchNetwork &e) { + } catch (const ArchNetworkException &e) { // ignore, there's not much we can do LOG_WARN("error closing socket: %s", e.what()); } @@ -184,7 +184,7 @@ void TCPSocket::shutdownInput() // shutdown socket for reading try { ARCH->closeSocketForRead(m_socket); - } catch (const XArchNetwork &e) { + } catch (const ArchNetworkException &e) { // ignore, there's not much we can do LOG_WARN("error closing socket: %s", e.what()); } @@ -210,7 +210,7 @@ void TCPSocket::shutdownOutput() // shutdown socket for writing try { ARCH->closeSocketForWrite(m_socket); - } catch (const XArchNetwork &e) { + } catch (const ArchNetworkException &e) { // ignore, there's not much we can do LOG_WARN("error closing socket: %s", e.what()); } @@ -265,7 +265,7 @@ void TCPSocket::connect(const NetworkAddress &addr) // connection is in progress m_writable = true; } - } catch (const XArchNetwork &e) { + } catch (const ArchNetworkException &e) { throw SocketConnectException(e.what()); } } @@ -284,11 +284,11 @@ void TCPSocket::init() // that should be sent without (much) delay. for example, the // mouse motion messages are much less useful if they're delayed. ARCH->setNoDelayOnSocket(m_socket, true); - } catch (const XArchNetwork &e) { + } catch (const ArchNetworkException &e) { try { ARCH->closeSocket(m_socket); m_socket = nullptr; - } catch (const XArchNetwork &e) { + } catch (const ArchNetworkException &e) { // ignore, there's not much we can do LOG_WARN("error closing socket: %s", e.what()); } @@ -469,7 +469,7 @@ ISocketMultiplexerJob *TCPSocket::serviceConnecting(ISocketMultiplexerJob *job, try { // connection may have failed or succeeded ARCH->throwErrorOnSocket(m_socket); - } catch (const XArchNetwork &e) { + } catch (const ArchNetworkException &e) { sendConnectionFailedEvent(e.what()); onDisconnected(); return newJob(); @@ -503,7 +503,7 @@ ISocketMultiplexerJob *TCPSocket::serviceConnected(ISocketMultiplexerJob *job, b if (write) { try { writeResult = doWrite(); - } catch (XArchNetworkShutdown &) { + } catch (ArchNetworkShutdownException &) { // remote read end of stream hungup. our output side // has therefore shutdown. onOutputShutdown(); @@ -513,12 +513,12 @@ ISocketMultiplexerJob *TCPSocket::serviceConnected(ISocketMultiplexerJob *job, b m_connected = false; } writeResult = New; - } catch (XArchNetworkDisconnected &) { + } catch (ArchNetworkDisconnectedException &) { // stream hungup onDisconnected(); sendEvent(SocketDisconnected); writeResult = New; - } catch (XArchNetwork &e) { + } catch (ArchNetworkException &e) { // other write error LOG_WARN("error writing socket: %s", e.what()); onDisconnected(); @@ -531,12 +531,12 @@ ISocketMultiplexerJob *TCPSocket::serviceConnected(ISocketMultiplexerJob *job, b if (read && m_readable) { try { readResult = doRead(); - } catch (XArchNetworkDisconnected &) { + } catch (ArchNetworkDisconnectedException &) { // stream hungup sendEvent(SocketDisconnected); onDisconnected(); readResult = New; - } catch (XArchNetwork &e) { + } catch (ArchNetworkException &e) { // ignore other read error LOG_WARN("error reading socket: %s", e.what()); } diff --git a/src/lib/platform/EiScreen.cpp b/src/lib/platform/EiScreen.cpp index 66f204bf7..d281c68d6 100644 --- a/src/lib/platform/EiScreen.cpp +++ b/src/lib/platform/EiScreen.cpp @@ -9,7 +9,7 @@ #include "platform/EiScreen.h" #include "arch/Arch.h" -#include "arch/XArch.h" +#include "arch/ArchException.h" #include "base/IEventQueue.h" #include "base/Log.h" #include "base/Stopwatch.h" diff --git a/src/lib/platform/OSXClipboard.cpp b/src/lib/platform/OSXClipboard.cpp index ac59e34af..5bb5b7638 100644 --- a/src/lib/platform/OSXClipboard.cpp +++ b/src/lib/platform/OSXClipboard.cpp @@ -7,7 +7,7 @@ #include "platform/OSXClipboard.h" -#include "arch/XArch.h" +#include "arch/ArchException.h" #include "base/Log.h" #include "deskflow/Clipboard.h" #include "platform/OSXClipboardBMPConverter.h" @@ -202,7 +202,7 @@ std::string OSXClipboard::get(Format format) const LOG_DEBUG("exception thrown in OSXClipboard::get MacError (%d)", err); } catch (...) { LOG_DEBUG("unknown exception in OSXClipboard::get"); - RETHROW_XTHREAD + RETHROW_THREADEXCEPTION } if (buffer != nullptr) diff --git a/src/lib/platform/OSXScreen.mm b/src/lib/platform/OSXScreen.mm index cf0aa687f..52d4bb2e4 100644 --- a/src/lib/platform/OSXScreen.mm +++ b/src/lib/platform/OSXScreen.mm @@ -8,7 +8,7 @@ #include "platform/OSXScreen.h" -#include "arch/XArch.h" +#include "arch/ArchException.h" #include "base/EventQueue.h" #include "base/IEventQueue.h" #include "base/Log.h" diff --git a/src/lib/platform/XWindowsScreen.cpp b/src/lib/platform/XWindowsScreen.cpp index 8d58dfa2b..121b5479c 100644 --- a/src/lib/platform/XWindowsScreen.cpp +++ b/src/lib/platform/XWindowsScreen.cpp @@ -9,7 +9,7 @@ #include "platform/XWindowsScreen.h" #include "arch/Arch.h" -#include "arch/XArch.h" +#include "arch/ArchException.h" #include "base/IEventQueue.h" #include "base/Log.h" #include "base/Stopwatch.h" diff --git a/src/unittests/legacytests/legacytests/arch/unix/ArchNetworkBSDTests.cpp b/src/unittests/legacytests/legacytests/arch/unix/ArchNetworkBSDTests.cpp index 35e1ae133..2684ae4c0 100644 --- a/src/unittests/legacytests/legacytests/arch/unix/ArchNetworkBSDTests.cpp +++ b/src/unittests/legacytests/legacytests/arch/unix/ArchNetworkBSDTests.cpp @@ -7,7 +7,7 @@ #include "arch/IArchNetwork.h" #include "lib/arch/unix/ArchNetworkBSD.h" -#include "lib/arch/XArch.h" +#include "lib/arch/ArchException.h" #include #include @@ -69,7 +69,7 @@ TEST(ArchNetworkBSDTests, pollSocket_mockAccessError_throws) const auto f = [&] { networkBSD.pollSocket(entries.data(), static_cast(entries.size()), 1); }; - EXPECT_THROW({ f(); }, XArchNetworkAccess); + EXPECT_THROW({ f(); }, ArchNetworkAccessException); } TEST(ArchNetworkBSDTests, pollSocket_pfdHasRevents_copiedToEntries)