openssl_exception is no longer used
Signed-off-by: Double Sine <xiao_ai_yu@live.cn>
This commit is contained in:
parent
7b2ad4c6a3
commit
3614e4bb7e
@ -18,7 +18,6 @@
|
||||
<ClInclude Include="$(MSBuildThisFileDirectory)exception.hpp" />
|
||||
<ClInclude Include="$(MSBuildThisFileDirectory)exceptions\index_exception.hpp" />
|
||||
<ClInclude Include="$(MSBuildThisFileDirectory)exceptions\key_exception.hpp" />
|
||||
<ClInclude Include="$(MSBuildThisFileDirectory)exceptions\openssl_exception.hpp" />
|
||||
<ClInclude Include="$(MSBuildThisFileDirectory)exceptions\win32_exception.hpp" />
|
||||
<ClInclude Include="$(MSBuildThisFileDirectory)exceptions\not_implemented_exception.hpp" />
|
||||
<ClInclude Include="$(MSBuildThisFileDirectory)exceptions\operation_canceled_exception.hpp" />
|
||||
@ -44,7 +43,6 @@
|
||||
<ClInclude Include="$(MSBuildThisFileDirectory)rsa_cipher.hpp" />
|
||||
</ItemGroup>
|
||||
<ItemGroup>
|
||||
<ClCompile Include="$(MSBuildThisFileDirectory)exceptions\openssl_exception.cpp" />
|
||||
<ClCompile Include="$(MSBuildThisFileDirectory)exceptions\win32_exception.cpp" />
|
||||
<ClCompile Include="$(MSBuildThisFileDirectory)rsa_cipher.cpp" />
|
||||
</ItemGroup>
|
||||
|
||||
@ -1,20 +0,0 @@
|
||||
#include "openssl_exception.hpp"
|
||||
#include <mutex>
|
||||
|
||||
#pragma comment(lib, "libcrypto")
|
||||
#pragma comment(lib, "crypt32") // required by libcrypto.lib
|
||||
#pragma comment(lib, "ws2_32") // required by libcrypto.lib
|
||||
|
||||
namespace nkg::exceptions {
|
||||
|
||||
openssl_exception::openssl_exception(std::string_view file, int line, error_code_t openssl_error_code, std::string_view message) noexcept :
|
||||
::nkg::exception(file, line, message)
|
||||
{
|
||||
static std::once_flag onceflag_load_crypto_strings;
|
||||
std::call_once(onceflag_load_crypto_strings, []() { ERR_load_crypto_strings(); });
|
||||
|
||||
m_error_code = openssl_error_code;
|
||||
m_error_string = ERR_reason_error_string(m_error_code);
|
||||
}
|
||||
|
||||
}
|
||||
@ -1,34 +0,0 @@
|
||||
#pragma once
|
||||
#include "../exception.hpp"
|
||||
#include <openssl/err.h>
|
||||
|
||||
namespace nkg::exceptions {
|
||||
|
||||
class openssl_exception final : public ::nkg::exception {
|
||||
public:
|
||||
using error_code_t = decltype(ERR_get_error());
|
||||
|
||||
private:
|
||||
error_code_t m_error_code;
|
||||
std::string m_error_string;
|
||||
|
||||
public:
|
||||
openssl_exception(std::string_view file, int line, error_code_t openssl_error_code, std::string_view message) noexcept;
|
||||
|
||||
[[nodiscard]]
|
||||
virtual bool error_code_exists() const noexcept override {
|
||||
return true;
|
||||
}
|
||||
|
||||
[[nodiscard]]
|
||||
virtual intptr_t error_code() const noexcept override {
|
||||
return m_error_code;
|
||||
}
|
||||
|
||||
[[nodiscard]]
|
||||
virtual const std::string& error_string() const noexcept override {
|
||||
return m_error_string;
|
||||
}
|
||||
};
|
||||
|
||||
}
|
||||
Loading…
Reference in New Issue
Block a user