aboutsummaryrefslogtreecommitdiff
path: root/c/data.cpp
diff options
context:
space:
mode:
authorJohn Ankarström <john@ankarstrom.se>2022-09-07 01:22:30 +0200
committerJohn Ankarström <john@ankarstrom.se>2022-09-07 01:22:30 +0200
commitac7d676a1c457f71f1d3ae17d74699dd95c9c985 (patch)
tree96d44cc6740de053db377ac51f3102b9871a90d4 /c/data.cpp
parentb2a018ff822bcdb5b9b691025a5fc1eb6fc13b4b (diff)
downloadEpisodeBrowser-ac7d676a1c457f71f1d3ae17d74699dd95c9c985.tar.gz
Normalize error message formatting.
Diffstat (limited to 'c/data.cpp')
-rw-r--r--c/data.cpp22
1 files changed, 11 insertions, 11 deletions
diff --git a/c/data.cpp b/c/data.cpp
index 32e059f..47f032b 100644
--- a/c/data.cpp
+++ b/c/data.cpp
@@ -20,18 +20,18 @@ UniqueOk<htmlParserCtxtPtr, xmlFreeParserCtxt> RemoteParserCtxt(const wchar_t* w
static Unique<HINTERNET, InternetCloseHandle> hi =
InternetOpenW(L"Episode Browser", INTERNET_OPEN_TYPE_DIRECT, nullptr, nullptr, 0);
if (hi.Bad(0))
- throw Err(WINDOWS, L"Internet handle could not be opened: %s");
+ throw Err(WINDOWS, L"Internet handle could not be opened: %s.");
Unique<HINTERNET, InternetCloseHandle> hiUrl = InternetOpenUrlW(
hi.v, wszUrl, nullptr, 0, INTERNET_FLAG_NO_UI, 0);
if (hiUrl.Bad(0))
- throw Err(WININET, L"Could not open "s + wszUrl + L": %s");
+ throw Err(WININET, L"Could not open "s + wszUrl + L": %s.");
char bufX[1024];
Unique<htmlParserCtxtPtr, xmlFreeParserCtxt> ctx = htmlCreatePushParserCtxt(
nullptr, nullptr, bufX, sizeof(bufX), szUrl, XML_CHAR_ENCODING_UTF8);
if (ctx.Bad(0))
- throw Err(LIBXML2, L"HTML parser context could not be created: %s");
+ throw Err(LIBXML2, L"HTML parser context could not be created: %s.");
htmlCtxtUseOptions(ctx.v, HTML_PARSE_RECOVER|HTML_PARSE_NOERROR|HTML_PARSE_NOWARNING);
@@ -40,9 +40,9 @@ UniqueOk<htmlParserCtxtPtr, xmlFreeParserCtxt> RemoteParserCtxt(const wchar_t* w
char bufI[1024];
while (r = InternetReadFile(hiUrl.v, bufI, sizeof(bufI), &cbRead), cbRead) {
if (!r)
- throw Err(WININET, L"HTML could not be retrieved: %s");
+ throw Err(WININET, L"HTML could not be retrieved: %s.");
if (!htmlParseChunk(ctx.v, bufI, cbRead, 0))
- throw Err(LIBXML2, L"HTML could not be parsed: %s");
+ throw Err(LIBXML2, L"HTML could not be parsed: %s.");
}
htmlParseChunk(ctx.v, bufI, 0, 1); /* Stop parsing. */
@@ -55,7 +55,7 @@ template <size_t N>
bool WcharsFromXmlchars(wchar_t (&dst)[N], Unique<xmlChar*, XmlFree> utf8)
{
if (utf8.Bad(0))
- throw Err(LIBXML2, L"Node content could not be retrieved: %s");
+ throw Err(LIBXML2, L"Node content could not be retrieved: %s.");
/* Truncate if source is larger than destination. */
int lenUtf8 = xmlStrlen(utf8.v);
@@ -153,7 +153,7 @@ void WaitFor(Window& window, void (*f)(unsigned char*))
std::thread(procThread, f).detach();
s_window->Status(L".", 1);
if (!(iTimer = SetTimer(nullptr, iTimer, 500, procTimer)))
- throw Err(WINDOWS, L"Timer could not be started: %s");
+ throw Err(WINDOWS, L"Timer could not be started: %s.");
}
void FetchData(unsigned char* sig)
@@ -173,13 +173,13 @@ void FetchData(unsigned char* sig)
Unique<xmlXPathContextPtr, xmlXPathFreeContext> xpathCtx = xmlXPathNewContext(ctx.v->myDoc);
if (xpathCtx.Bad(0))
- throw Err(LIBXML2, L"XPath context could not be created: %s");
+ throw Err(LIBXML2, L"XPath context could not be created: %s.");
Unique<xmlXPathObjectPtr, xmlXPathFreeObject> xpathObj = xmlXPathEvalExpression(
reinterpret_cast<const xmlChar*>("//tr[./td[1] != '' and ./td[3][@style='background:#f2fde9;']]"),
xpathCtx.v);
if (xpathObj.Bad(0))
- throw Err(LIBXML2, L"XPath object could not be created: %s");
+ throw Err(LIBXML2, L"XPath object could not be created: %s.");
xmlNodeSetPtr nodes = xpathObj.v->nodesetval;
@@ -270,13 +270,13 @@ void FetchScreenwriters(unsigned char* sig)
UniqueOk<htmlParserCtxtPtr, xmlFreeParserCtxt> ctx = RemoteParserCtxt(url, nullptr);
xpathCtx = xmlXPathNewContext(ctx.v->myDoc);
if (xpathCtx.Bad(0))
- throw Err(LIBXML2, L"XPath context could not be created: %s");
+ throw Err(LIBXML2, L"XPath context could not be created: %s.");
xpathObj = xmlXPathEvalExpression(reinterpret_cast<const xmlChar*>(
"//th[contains(text(), 'Screenplay:')]/following-sibling::td"),
xpathCtx.v);
if (xpathObj.Bad(0))
- throw Err(LIBXML2, L"XPath object could not be created: %s");
+ throw Err(LIBXML2, L"XPath object could not be created: %s.");
xmlNodeSetPtr nodes = xpathObj.v->nodesetval;
if (nodes && nodes->nodeNr)