diff options
author | John Ankarström <john@ankarstrom.se> | 2022-09-03 15:28:56 +0200 |
---|---|---|
committer | John Ankarström <john@ankarstrom.se> | 2022-09-03 15:28:56 +0200 |
commit | 6ae7e24675cff4ff6b808c3024f45083f35ced97 (patch) | |
tree | 2a47273f325d8367db2a8669691273f02ca83eb9 /c/debug.cpp | |
parent | 2cd22c671c67deaf2c1fcb659e3262bf57552557 (diff) | |
download | EpisodeBrowser-6ae7e24675cff4ff6b808c3024f45083f35ced97.tar.gz |
Improve error handling.
Diffstat (limited to 'c/debug.cpp')
-rw-r--r-- | c/debug.cpp | 9 |
1 files changed, 5 insertions, 4 deletions
diff --git a/c/debug.cpp b/c/debug.cpp index 3e20d73..39dfb5d 100644 --- a/c/debug.cpp +++ b/c/debug.cpp @@ -3,6 +3,7 @@ #include <windows.h> #include "debug.h" +#include "err.h" #include "win32.h" struct Avg { @@ -19,17 +20,17 @@ Benchmark::Benchmark(const char* const name, const int id, const int avgmax) { if (!freq) { if (!QueryPerformanceFrequency(&liFreq)) - throw Win32Error(); + throw Err(WINDOWS, L"Tick frequency could not be queried: %s"); freq = liFreq.QuadPart; } LARGE_INTEGER liTicks; if (!QueryPerformanceCounter(&liTicks)) - throw Win32Error(); + throw Err(WINDOWS, L"Ticks could not be retrieved: %s"); ticks = liTicks.QuadPart; } -void Benchmark::Disable() +void Benchmark::Disable() noexcept { disabled = true; } @@ -66,7 +67,7 @@ Benchmark::~Benchmark() } } -const char* WmName(const UINT uMsg) +const char* WmName(const UINT uMsg) noexcept { static const UINT vKey[] = { 0, 1, 2, 3, 5, 6, 7, 8, 10, 11, 12, 13, 14, 15, 16, 17, 18, |