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.
diff --git a/common/rfb/CConnection.cxx b/common/rfb/CConnection.cxx
index 88befd5..ce489b1 100644
--- a/common/rfb/CConnection.cxx
+++ b/common/rfb/CConnection.cxx
@@ -270,12 +270,10 @@
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);
}