diff options
author | John Ankarström <john@ankarstrom.se> | 2022-09-07 23:33:08 +0200 |
---|---|---|
committer | John Ankarström <john@ankarstrom.se> | 2022-09-07 23:33:08 +0200 |
commit | b5917be252caf9d38ae9466352c4176ef25732e3 (patch) | |
tree | 8eee2398b84cd533999a6d6f7539131daef5acfd /c/data.cpp | |
parent | ac7d676a1c457f71f1d3ae17d74699dd95c9c985 (diff) | |
download | EpisodeBrowser-b5917be252caf9d38ae9466352c4176ef25732e3.tar.gz |
Simplify Err message format.
Diffstat (limited to 'c/data.cpp')
-rw-r--r-- | c/data.cpp | 26 |
1 files changed, 13 insertions, 13 deletions
@@ -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"); 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""); 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"); 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"); 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"); } 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"); /* 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"); } void FetchData(unsigned char* sig) @@ -173,18 +173,18 @@ 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"); 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"); xmlNodeSetPtr nodes = xpathObj.v->nodesetval; if (!nodes || !nodes->nodeNr) - throw Err(GENERIC, L"Data retrieval failed: No matching HTML nodes found."); + throw Err(GENERIC, L"Data retrieval failed: No matching HTML nodes found"); for (int i = 0; i < nodes->nodeNr; i++) { if (*sig & ABORT) @@ -192,7 +192,7 @@ void FetchData(unsigned char* sig) const xmlNodePtr node = nodes->nodeTab[i]; if (xmlChildElementCount(node) != 8) - throw Err(GENERIC, L"Data retrieval failed: Unexcepted number of columns in table."); + throw Err(GENERIC, L"Data retrieval failed: Unexcepted number of columns in table"); ElvDataA& e = s_window->fvElv.At(i); DlvDataA& d = s_window->fvDlv.At(i); @@ -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"); 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"); xmlNodeSetPtr nodes = xpathObj.v->nodesetval; if (nodes && nodes->nodeNr) |