From 6ae7e24675cff4ff6b808c3024f45083f35ced97 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?John=20Ankarstr=C3=B6m?= Date: Sat, 3 Sep 2022 15:28:56 +0200 Subject: Improve error handling. --- c/debug.cpp | 9 +++++---- 1 file changed, 5 insertions(+), 4 deletions(-) (limited to 'c/debug.cpp') 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 #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, -- cgit v1.2.3