Improve exception constructors
This commit is contained in:
parent
2c856e3976
commit
af5d9147b4
|
@ -5,19 +5,4 @@ namespace Io {
|
|||
* \class CryptoException
|
||||
* \brief The exception that is thrown when an encryption/decryption error occurs.
|
||||
*/
|
||||
|
||||
/*!
|
||||
* \brief Constructs a crypto exception.
|
||||
*/
|
||||
CryptoException::CryptoException(const std::string &openSslErrorQueue) noexcept
|
||||
: runtime_error(openSslErrorQueue)
|
||||
{
|
||||
}
|
||||
|
||||
/*!
|
||||
* \brief Destroys the exception.
|
||||
*/
|
||||
CryptoException::~CryptoException() noexcept
|
||||
{
|
||||
}
|
||||
} // namespace Io
|
||||
|
|
|
@ -10,9 +10,26 @@ namespace Io {
|
|||
|
||||
class PASSWORD_FILE_EXPORT CryptoException : public std::runtime_error {
|
||||
public:
|
||||
CryptoException(const std::string &openSslErrorQueue) noexcept;
|
||||
~CryptoException() noexcept;
|
||||
explicit CryptoException(const std::string &message) noexcept;
|
||||
explicit CryptoException(const char *message) noexcept;
|
||||
};
|
||||
|
||||
/*!
|
||||
* \brief Constructs a crypto exception.
|
||||
*/
|
||||
inline CryptoException::CryptoException(const std::string &message) noexcept
|
||||
: runtime_error(message)
|
||||
{
|
||||
}
|
||||
|
||||
/*!
|
||||
* \brief Constructs a crypto exception.
|
||||
*/
|
||||
inline CryptoException::CryptoException(const char *message) noexcept
|
||||
: runtime_error(message)
|
||||
{
|
||||
}
|
||||
|
||||
} // namespace Io
|
||||
|
||||
#endif // PASSWORD_FILE_IO_CRYPTOFAILUREEXCEPTION_H
|
||||
|
|
|
@ -7,18 +7,4 @@ namespace Io {
|
|||
* \brief The exception that is thrown when a parsing error occurs.
|
||||
*/
|
||||
|
||||
/*!
|
||||
* \brief Constructs a parsing exception.
|
||||
*/
|
||||
ParsingException::ParsingException(const std::string &message) noexcept
|
||||
: runtime_error(message)
|
||||
{
|
||||
}
|
||||
|
||||
/*!
|
||||
* \brief Destroys the exception.
|
||||
*/
|
||||
ParsingException::~ParsingException() noexcept
|
||||
{
|
||||
}
|
||||
} // namespace Io
|
||||
|
|
|
@ -10,9 +10,26 @@ namespace Io {
|
|||
|
||||
class PASSWORD_FILE_EXPORT ParsingException : public std::runtime_error {
|
||||
public:
|
||||
ParsingException(const std::string &message = std::string()) noexcept;
|
||||
~ParsingException() noexcept;
|
||||
explicit ParsingException(const std::string &message = std::string()) noexcept;
|
||||
explicit ParsingException(const char *message) noexcept;
|
||||
};
|
||||
|
||||
/*!
|
||||
* \brief Constructs a parsing exception.
|
||||
*/
|
||||
inline ParsingException::ParsingException(const std::string &message) noexcept
|
||||
: runtime_error(message)
|
||||
{
|
||||
}
|
||||
|
||||
/*!
|
||||
* \brief Constructs a parsing exception.
|
||||
*/
|
||||
inline ParsingException::ParsingException(const char *message) noexcept
|
||||
: runtime_error(message)
|
||||
{
|
||||
}
|
||||
|
||||
} // namespace Io
|
||||
|
||||
#endif // PASSWORD_FILE_IO_PARSINGEXCEPTION_H
|
||||
|
|
|
@ -293,7 +293,7 @@ void PasswordFile::load()
|
|||
msg += ERR_error_string(errorCode, nullptr);
|
||||
errorCode = ERR_get_error();
|
||||
}
|
||||
throw CryptoException(msg);
|
||||
throw CryptoException(move(msg));
|
||||
}
|
||||
|
||||
if (ctx) {
|
||||
|
@ -532,7 +532,7 @@ void PasswordFile::write(PasswordFileSaveFlags options)
|
|||
msg += ERR_error_string(errorCode, nullptr);
|
||||
errorCode = ERR_get_error();
|
||||
}
|
||||
throw CryptoException(msg);
|
||||
throw CryptoException(move(msg));
|
||||
}
|
||||
|
||||
if (ctx) {
|
||||
|
|
|
@ -44,7 +44,7 @@ OpenSslRandomDevice::result_type OpenSslRandomDevice::operator()() const
|
|||
errorMsg += ERR_error_string(errorCode, nullptr);
|
||||
errorCode = ERR_get_error();
|
||||
}
|
||||
throw Io::CryptoException(errorMsg);
|
||||
throw Io::CryptoException(move(errorMsg));
|
||||
}
|
||||
|
||||
/*!
|
||||
|
|
Loading…
Reference in New Issue