blob: a9cb7b8c692e2db8ff8b8e0906265851d1af3fd9 (
plain) (
blame)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
|
#pragma once
#include <system_error>
#include <string>
namespace rawaccel {
class error : public std::runtime_error {
using std::runtime_error::runtime_error;
};
class io_error : public error {
using error::error;
};
class install_error : public io_error {
public:
install_error() :
io_error("Raw Accel is not installed, run installer.exe") {}
};
class sys_error : public io_error {
public:
sys_error(const char* msg, DWORD code = GetLastError()) :
io_error(build_msg(code, msg)) {}
static std::string build_msg(DWORD code, const char* msg)
{
std::string ret =
std::system_error(code, std::system_category(), msg).what();
ret += " (";
ret += std::to_string(code);
ret += ")";
return ret;
}
};
}
|