From 19225507cca088ff965ccfc91bcf6f1fcd9960b3 Mon Sep 17 00:00:00 2001 From: Pierre Ossman Date: Thu, 12 Oct 2017 15:05:07 +0200 Subject: Make exception classes have clearer messages Include the type of exception in the string generated by each subclass. Also simplify the constructs to what is needed. --- common/rfb/CConnection.cxx | 8 +++----- 1 file changed, 3 insertions(+), 5 deletions(-) (limited to 'common/rfb/CConnection.cxx') diff --git a/common/rfb/CConnection.cxx b/common/rfb/CConnection.cxx index 88befd5e..ce489b1b 100644 --- a/common/rfb/CConnection.cxx +++ b/common/rfb/CConnection.cxx @@ -270,12 +270,10 @@ void CConnection::processSecurityResultMsg() default: throw Exception("Unknown security result from server"); } - CharArray reason; - if (cp.beforeVersion(3,8)) - reason.buf = strDup("Authentication failure"); - else - reason.buf = is->readString(); state_ = RFBSTATE_INVALID; + if (cp.beforeVersion(3,8)) + throw AuthFailureException(); + CharArray reason(is->readString()); throw AuthFailureException(reason.buf); } -- cgit v1.2.3