MAINT-5011: Derive remaining exception classes from std::exception.
In particular: NotImplemented in llhttpnode.cpp RelocateError in llupdateinstaller.cpp LLProtectedDataException, LLCertException and subclasses in llsecapi.h Had to add no-throw destructor overrides to LLCertException and subclasses because otherwise clang complains that the implicitly-generated destructor's exception specification is more lax than the base class's.master
parent
1a3fa64ecc
commit
b031b1a625
|
|
@ -31,6 +31,7 @@
|
|||
|
||||
#include "llstl.h"
|
||||
#include "llhttpconstants.h"
|
||||
#include <stdexcept>
|
||||
|
||||
const std::string CONTEXT_HEADERS("headers");
|
||||
const std::string CONTEXT_PATH("path");
|
||||
|
|
@ -92,8 +93,9 @@ LLHTTPNode::~LLHTTPNode()
|
|||
|
||||
|
||||
namespace {
|
||||
class NotImplemented
|
||||
struct NotImplemented: public std::runtime_error
|
||||
{
|
||||
NotImplemented(): std::runtime_error("LLHTTPNode::NotImplemented") {}
|
||||
};
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -69,7 +69,7 @@ void initializeSecHandler()
|
|||
}
|
||||
if (!exception_msg.empty()) // an exception was thrown.
|
||||
{
|
||||
throw LLProtectedDataException(exception_msg.c_str());
|
||||
throw LLProtectedDataException(exception_msg);
|
||||
}
|
||||
|
||||
}
|
||||
|
|
|
|||
|
|
@ -32,6 +32,7 @@
|
|||
#include <openssl/x509.h>
|
||||
#include <ostream>
|
||||
#include "llpointer.h"
|
||||
#include <stdexcept>
|
||||
|
||||
#ifdef LL_WINDOWS
|
||||
#pragma warning(disable:4250)
|
||||
|
|
@ -116,17 +117,14 @@
|
|||
|
||||
|
||||
|
||||
class LLProtectedDataException
|
||||
struct LLProtectedDataException: public std::runtime_error
|
||||
{
|
||||
public:
|
||||
LLProtectedDataException(const char *msg)
|
||||
LLProtectedDataException(const std::string& msg):
|
||||
std::runtime_error(msg)
|
||||
{
|
||||
LL_WARNS("SECAPI") << "Protected Data Error: " << (std::string)msg << LL_ENDL;
|
||||
mMsg = (std::string)msg;
|
||||
LL_WARNS("SECAPI") << "Protected Data Error: " << msg << LL_ENDL;
|
||||
}
|
||||
std::string getMessage() { return mMsg; }
|
||||
protected:
|
||||
std::string mMsg;
|
||||
std::string getMessage() { return what(); }
|
||||
};
|
||||
|
||||
// class LLCertificate
|
||||
|
|
@ -334,22 +332,22 @@ std::ostream& operator <<(std::ostream& s, const LLCredential& cred);
|
|||
|
||||
// All error handling is via exceptions.
|
||||
|
||||
class LLCertException
|
||||
class LLCertException: public std::runtime_error
|
||||
{
|
||||
public:
|
||||
LLCertException(LLPointer<LLCertificate> cert, const char* msg)
|
||||
LLCertException(LLPointer<LLCertificate> cert, const std::string& msg):
|
||||
std::runtime_error(msg)
|
||||
{
|
||||
|
||||
mCert = cert;
|
||||
|
||||
LL_WARNS("SECAPI") << "Certificate Error: " << (std::string)msg << LL_ENDL;
|
||||
mMsg = (std::string)msg;
|
||||
LL_WARNS("SECAPI") << "Certificate Error: " << msg << LL_ENDL;
|
||||
}
|
||||
virtual ~LLCertException() throw() {}
|
||||
LLPointer<LLCertificate> getCert() { return mCert; }
|
||||
std::string getMessage() { return mMsg; }
|
||||
std::string getMessage() { return what(); }
|
||||
protected:
|
||||
LLPointer<LLCertificate> mCert;
|
||||
std::string mMsg;
|
||||
};
|
||||
|
||||
class LLInvalidCertificate : public LLCertException
|
||||
|
|
@ -358,6 +356,7 @@ public:
|
|||
LLInvalidCertificate(LLPointer<LLCertificate> cert) : LLCertException(cert, "CertInvalid")
|
||||
{
|
||||
}
|
||||
virtual ~LLInvalidCertificate() throw() {}
|
||||
protected:
|
||||
};
|
||||
|
||||
|
|
@ -367,6 +366,7 @@ public:
|
|||
LLCertValidationTrustException(LLPointer<LLCertificate> cert) : LLCertException(cert, "CertUntrusted")
|
||||
{
|
||||
}
|
||||
virtual ~LLCertValidationTrustException() throw() {}
|
||||
protected:
|
||||
};
|
||||
|
||||
|
|
@ -378,7 +378,7 @@ public:
|
|||
{
|
||||
mHostname = hostname;
|
||||
}
|
||||
|
||||
virtual ~LLCertValidationHostnameException() throw() {}
|
||||
std::string getHostname() { return mHostname; }
|
||||
protected:
|
||||
std::string mHostname;
|
||||
|
|
@ -392,6 +392,7 @@ public:
|
|||
{
|
||||
mTime = current_time;
|
||||
}
|
||||
virtual ~LLCertValidationExpirationException() throw() {}
|
||||
LLDate GetTime() { return mTime; }
|
||||
protected:
|
||||
LLDate mTime;
|
||||
|
|
@ -403,6 +404,7 @@ public:
|
|||
LLCertKeyUsageValidationException(LLPointer<LLCertificate> cert) : LLCertException(cert, "CertKeyUsage")
|
||||
{
|
||||
}
|
||||
virtual ~LLCertKeyUsageValidationException() throw() {}
|
||||
protected:
|
||||
};
|
||||
|
||||
|
|
@ -412,6 +414,7 @@ public:
|
|||
LLCertBasicConstraintsValidationException(LLPointer<LLCertificate> cert) : LLCertException(cert, "CertBasicConstraints")
|
||||
{
|
||||
}
|
||||
virtual ~LLCertBasicConstraintsValidationException() throw() {}
|
||||
protected:
|
||||
};
|
||||
|
||||
|
|
@ -421,6 +424,7 @@ public:
|
|||
LLCertValidationInvalidSignatureException(LLPointer<LLCertificate> cert) : LLCertException(cert, "CertInvalidSignature")
|
||||
{
|
||||
}
|
||||
virtual ~LLCertValidationInvalidSignatureException() throw() {}
|
||||
protected:
|
||||
};
|
||||
|
||||
|
|
|
|||
|
|
@ -35,12 +35,14 @@
|
|||
#pragma warning(disable: 4702) // disable 'unreachable code' so we can use lexical_cast (really!).
|
||||
#endif
|
||||
#include <boost/lexical_cast.hpp>
|
||||
|
||||
#include <stdexcept>
|
||||
|
||||
namespace {
|
||||
class RelocateError {};
|
||||
|
||||
|
||||
struct RelocateError: public std::runtime_error
|
||||
{
|
||||
RelocateError(): std::runtime_error("llupdateinstaller: RelocateError") {}
|
||||
};
|
||||
|
||||
std::string copy_to_temp(std::string const & path)
|
||||
{
|
||||
std::string scriptFile = gDirUtilp->getBaseFileName(path);
|
||||
|
|
|
|||
Loading…
Reference in New Issue