aboutsummaryrefslogtreecommitdiff
path: root/c/ext.cpp
diff options
context:
space:
mode:
authorJohn Ankarström <john@ankarstrom.se>2022-09-03 15:28:56 +0200
committerJohn Ankarström <john@ankarstrom.se>2022-09-03 15:28:56 +0200
commit6ae7e24675cff4ff6b808c3024f45083f35ced97 (patch)
tree2a47273f325d8367db2a8669691273f02ca83eb9 /c/ext.cpp
parent2cd22c671c67deaf2c1fcb659e3262bf57552557 (diff)
downloadEpisodeBrowser-6ae7e24675cff4ff6b808c3024f45083f35ced97.tar.gz
Improve error handling.
Diffstat (limited to 'c/ext.cpp')
-rw-r--r--c/ext.cpp10
1 files changed, 5 insertions, 5 deletions
diff --git a/c/ext.cpp b/c/ext.cpp
index ea6718a..ab47ab4 100644
--- a/c/ext.cpp
+++ b/c/ext.cpp
@@ -12,7 +12,7 @@ bool OpenOnline(const CfgA& cfg, int iEp)
INT_PTR r = reinterpret_cast<INT_PTR>(
ShellExecuteW(nullptr, L"open", url, nullptr, nullptr, SW_SHOWNORMAL));
if (r <= 32)
- throw Win32Error();
+ throw Err(WINDOWS, L"Address "s + url + L" could not be opened: %s");
return true;
}
@@ -23,7 +23,7 @@ bool OpenWiki(const DlvDataA& d)
INT_PTR r = reinterpret_cast<INT_PTR>(
ShellExecuteW(nullptr, L"open", url, nullptr, nullptr, SW_SHOWNORMAL));
if (r <= 32)
- throw Win32Error();
+ throw Err(WINDOWS, L"Address "s + url + L" could not be opened: %s");
return true;
}
@@ -84,7 +84,7 @@ static bool FindMatchingFile(wchar_t (&file)[MAX_PATH], const wchar_t* const roo
WIN32_FIND_DATA fdata;
Unique<HANDLE, FindClose> h = FindFirstFileW(pat, &fdata);
if (h.Bad(INVALID_HANDLE_VALUE))
- throw Win32Error();
+ throw Err(WINDOWS, L"Directory "s + root + L" could not be traversed: %s");
do
if (fdata.cFileName[0] == L'.')
@@ -102,7 +102,7 @@ static bool FindMatchingFile(wchar_t (&file)[MAX_PATH], const wchar_t* const roo
while (FindNextFileW(h.v, &fdata));
if (GetLastError() != ERROR_NO_MORE_FILES)
- throw Win32Error();
+ throw Err(WINDOWS, L"Next file in "s + root + L" could not be accessed: %s");
return false;
}
@@ -114,7 +114,7 @@ bool OpenLocally(CfgA& cfg, const ElvDataA& e)
INT_PTR r = reinterpret_cast<INT_PTR>(
ShellExecuteW(nullptr, L"open", file, nullptr, nullptr, SW_SHOWNORMAL));
if (r <= 32)
- throw Win32Error();
+ throw Err(WINDOWS, L"File "s + file + L" could not be opened: %s");
return true;
} else
return false;