NavicatCrack/common/exceptions/openssl_exception.hpp

35 lines
861 B
C++

#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;
}
};
}