aboutsummaryrefslogtreecommitdiffstats
path: root/common/rfb/CConnection.cxx
diff options
context:
space:
mode:
authorPierre Ossman <ossman@cendio.se>2024-11-07 10:37:53 +0100
committerPierre Ossman <ossman@cendio.se>2024-11-07 10:37:53 +0100
commitf7507aea98b1a428d02fe5c41d25ee69dd5436bb (patch)
tree49f9349a1d7441874d1cb6d4428e2bcb0d63b422 /common/rfb/CConnection.cxx
parent7508e9887de022e127d8fadb9f6a6bd8e9778864 (diff)
parent2b7857283b834391266e414adcff8c20f8fe3067 (diff)
downloadtigervnc-f7507aea98b1a428d02fe5c41d25ee69dd5436bb.tar.gz
tigervnc-f7507aea98b1a428d02fe5c41d25ee69dd5436bb.zip
Merge branch 'stdexcept' of github.com:CendioOssman/tigervnc
Diffstat (limited to 'common/rfb/CConnection.cxx')
-rw-r--r--common/rfb/CConnection.cxx28
1 files changed, 15 insertions, 13 deletions
diff --git a/common/rfb/CConnection.cxx b/common/rfb/CConnection.cxx
index b4017dba..a4d6d173 100644
--- a/common/rfb/CConnection.cxx
+++ b/common/rfb/CConnection.cxx
@@ -147,11 +147,11 @@ bool CConnection::processMsg()
case RFBSTATE_INITIALISATION: return processInitMsg(); break;
case RFBSTATE_NORMAL: return reader_->readMsg(); break;
case RFBSTATE_CLOSING:
- throw Exception("CConnection::processMsg: called while closing");
+ throw std::logic_error("CConnection::processMsg: called while closing");
case RFBSTATE_UNINITIALISED:
- throw Exception("CConnection::processMsg: not initialised yet?");
+ throw std::logic_error("CConnection::processMsg: not initialised yet?");
default:
- throw Exception("CConnection::processMsg: invalid state");
+ throw std::logic_error("CConnection::processMsg: invalid state");
}
}
@@ -172,7 +172,7 @@ bool CConnection::processVersionMsg()
if (sscanf(verStr, "RFB %03d.%03d\n",
&majorVersion, &minorVersion) != 2) {
state_ = RFBSTATE_INVALID;
- throw Exception("reading version failed: not an RFB server?");
+ throw protocol_error("reading version failed: not an RFB server?");
}
server.setVersion(majorVersion, minorVersion);
@@ -185,8 +185,10 @@ bool CConnection::processVersionMsg()
vlog.error("Server gave unsupported RFB protocol version %d.%d",
server.majorVersion, server.minorVersion);
state_ = RFBSTATE_INVALID;
- throw Exception("Server gave unsupported RFB protocol version %d.%d",
- server.majorVersion, server.minorVersion);
+ throw protocol_error(format("Server gave unsupported RFB protocol "
+ "version %d.%d",
+ server.majorVersion,
+ server.minorVersion));
} else if (server.beforeVersion(3,7)) {
server.setVersion(3,3);
} else if (server.afterVersion(3,8)) {
@@ -233,7 +235,7 @@ bool CConnection::processSecurityTypesMsg()
secType = secTypeInvalid;
} else {
vlog.error("Unknown 3.3 security type %d", secType);
- throw Exception("Unknown 3.3 security type");
+ throw protocol_error("Unknown 3.3 security type");
}
} else {
@@ -283,7 +285,7 @@ bool CConnection::processSecurityTypesMsg()
if (secType == secTypeInvalid) {
state_ = RFBSTATE_INVALID;
vlog.error("No matching security types");
- throw Exception("No matching security types");
+ throw protocol_error("No matching security types");
}
state_ = RFBSTATE_SECURITY;
@@ -327,12 +329,12 @@ bool CConnection::processSecurityResultMsg()
vlog.debug("auth failed - too many tries");
break;
default:
- throw Exception("Unknown security result from server");
+ throw protocol_error("Unknown security result from server");
}
if (server.beforeVersion(3,8)) {
state_ = RFBSTATE_INVALID;
- throw AuthFailureException("Authentication failed");
+ throw auth_error("Authentication failed");
}
state_ = RFBSTATE_SECURITY_REASON;
@@ -358,7 +360,7 @@ bool CConnection::processSecurityReasonMsg()
reason[len] = '\0';
state_ = RFBSTATE_INVALID;
- throw AuthFailureException(reason.data());
+ throw auth_error(reason.data());
}
bool CConnection::processInitMsg()
@@ -387,8 +389,8 @@ void CConnection::close()
*/
try {
decoder.flush();
- } catch (rdr::Exception& e) {
- vlog.error("%s", e.str());
+ } catch (std::exception& e) {
+ vlog.error("%s", e.what());
}
setFramebuffer(nullptr);