summaryrefslogtreecommitdiff
path: root/common/rawaccel-io.hpp
diff options
context:
space:
mode:
authora1xd <[email protected]>2020-08-11 23:49:34 -0400
committerGitHub <[email protected]>2020-08-11 23:49:34 -0400
commit08759509371ada546c8d9bc4053b9450c4f58e8b (patch)
tree7ffc41237725e3ec0e9f53313644365912ded060 /common/rawaccel-io.hpp
parentMerge pull request #12 from JacobPalecki/GUI (diff)
parentdefine exceptions for invalid arg & io errors (diff)
downloadrawaccel-08759509371ada546c8d9bc4053b9450c4f58e8b.tar.xz
rawaccel-08759509371ada546c8d9bc4053b9450c4f58e8b.zip
Merge pull request #13 from a1xd/write-cd
write cooldown
Diffstat (limited to 'common/rawaccel-io.hpp')
-rw-r--r--common/rawaccel-io.hpp9
1 files changed, 6 insertions, 3 deletions
diff --git a/common/rawaccel-io.hpp b/common/rawaccel-io.hpp
index fc64c7d..7f55392 100644
--- a/common/rawaccel-io.hpp
+++ b/common/rawaccel-io.hpp
@@ -21,7 +21,7 @@ namespace rawaccel {
ra_handle = CreateFileW(L"\\\\.\\rawaccel", 0, 0, 0, OPEN_EXISTING, 0, 0);
if (ra_handle == INVALID_HANDLE_VALUE) {
- throw std::system_error(GetLastError(), std::system_category(), "CreateFile failed");
+ throw install_error();
}
mouse_modifier mod;
@@ -54,7 +54,7 @@ namespace rawaccel {
ra_handle = CreateFileW(L"\\\\.\\rawaccel", 0, 0, 0, OPEN_EXISTING, 0, 0);
if (ra_handle == INVALID_HANDLE_VALUE) {
- throw std::system_error(GetLastError(), std::system_category(), "CreateFile failed");
+ throw install_error();
}
DWORD dummy;
@@ -73,7 +73,10 @@ namespace rawaccel {
CloseHandle(ra_handle);
if (!success) {
- throw std::system_error(GetLastError(), std::system_category(), "DeviceIoControl failed");
+ if (auto err = GetLastError(); err != ERROR_BUSY) {
+ throw std::system_error(err, std::system_category(), "DeviceIoControl failed");
+ }
+ throw cooldown_error();
}
}