From ac7d676a1c457f71f1d3ae17d74699dd95c9c985 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?John=20Ankarstr=C3=B6m?= Date: Wed, 7 Sep 2022 01:22:30 +0200 Subject: Normalize error message formatting. --- c/data.cpp | 22 +++++++++++----------- 1 file changed, 11 insertions(+), 11 deletions(-) (limited to 'c/data.cpp') 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 RemoteParserCtxt(const wchar_t* w static Unique 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 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 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 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 bool WcharsFromXmlchars(wchar_t (&dst)[N], Unique 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 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 xpathObj = xmlXPathEvalExpression( reinterpret_cast("//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 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( "//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) -- cgit v1.2.3