# stdex: include/stdex/errno.hpp Source File

Loading...
Searching...
No Matches
errno.hpp
/*
SPDX-License-Identifier: MIT
Copyright © 2023 Amebis
*/
#pragma once
#include "sal.hpp"
#include <stdexcept>
#include <cstring>
namespace stdex
{
class errno_error : public std::runtime_error
{
public:
errno_error(_In_ errno_t num, _In_ const std::string& msg) :
m_num(num),
runtime_error(msg)
{
}
errno_error(_In_ errno_t num, _In_opt_z_ const char *msg = nullptr) :
m_num(num),
runtime_error(msg)
{
}
errno_error(_In_ const std::string& msg) :
m_num(errno),
runtime_error(msg)
{
}
errno_error(_In_opt_z_ const char *msg = nullptr) :
m_num(errno),
runtime_error(msg)
{
}
errno_t number() const
{
return m_num;
}
protected:
errno_t m_num;
};
}
stdex::errno_error
Standard C runtime library error.
Definition errno.hpp:18
stdex::errno_error::m_num
errno_t m_num
Numeric error code.
Definition errno.hpp:75
stdex::errno_error::errno_error
errno_error(errno_t num, const std::string &msg)
Constructs an exception.
Definition errno.hpp:26
stdex::errno_error::number
errno_t number() const
Returns the error number.
Definition errno.hpp:69
stdex::errno_error::errno_error
errno_error(const std::string &msg)
Constructs an exception using GetLastError()
Definition errno.hpp:49
stdex::errno_error::errno_error
errno_error(const char *msg=nullptr)
Constructs an exception using GetLastError()
Definition errno.hpp:60
stdex::errno_error::errno_error
errno_error(errno_t num, const char *msg=nullptr)
Constructs an exception.
Definition errno.hpp:38