You are viewing a plain text version of this content. The canonical link for it is here.
Posted to c-dev@xerces.apache.org by sc...@apache.org on 2024/09/23 17:40:05 UTC
(xerces-c) 03/04: Add NetAcc_CurlError and fix NetAcc_InternalError message to show URL
This is an automated email from the ASF dual-hosted git repository.
scantor pushed a commit to branch xerces-3.3
in repository https://gitbox.apache.org/repos/asf/xerces-c.git
commit 789e353368f7274923ab2d0bbd0620dd831adb31
Author: William S Fulton <ws...@fultondesigns.co.uk>
AuthorDate: Thu Aug 8 09:06:27 2024 +0100
Add NetAcc_CurlError and fix NetAcc_InternalError message to show URL
---
src/xercesc/NLS/EN_US/XMLErrList_EN_US.Xml | 3 ++-
.../util/NetAccessors/Curl/CurlURLInputStream.cpp | 16 +++++++++++++++-
2 files changed, 17 insertions(+), 2 deletions(-)
diff --git a/src/xercesc/NLS/EN_US/XMLErrList_EN_US.Xml b/src/xercesc/NLS/EN_US/XMLErrList_EN_US.Xml
index 271f0086d..d93b72c80 100644
--- a/src/xercesc/NLS/EN_US/XMLErrList_EN_US.Xml
+++ b/src/xercesc/NLS/EN_US/XMLErrList_EN_US.Xml
@@ -474,7 +474,8 @@
<Message Id="HshTbl_BadHashFromKey" Text="hashing key produced invalid hash"/>
<Message Id="HshTbl_NoSuchKeyExists" Text="no such key in hash table"/>
<Message Id="Mutex_CouldNotDestroy" Text="unable to destroy mutex"/>
- <Message Id="NetAcc_InternalError" Text="internal error in NetAccessor"/>
+ <Message Id="NetAcc_InternalError" Text="internal error in NetAccessor for URL {0}"/>
+ <Message Id="NetAcc_CurlError" Text="libcurl error in NetAccessor for URL {0} '{1}:{2}'"/>
<Message Id="NetAcc_LengthError" Text="NetAccessor is unable to determine length of remote file"/>
<Message Id="NetAcc_InitFailed" Text="unable to initialize NetAccessor"/>
<Message Id="NetAcc_TargetResolution" Text="unable to resolve host/address '{0}'"/>
diff --git a/src/xercesc/util/NetAccessors/Curl/CurlURLInputStream.cpp b/src/xercesc/util/NetAccessors/Curl/CurlURLInputStream.cpp
index 2980dc211..17ddf0261 100644
--- a/src/xercesc/util/NetAccessors/Curl/CurlURLInputStream.cpp
+++ b/src/xercesc/util/NetAccessors/Curl/CurlURLInputStream.cpp
@@ -332,7 +332,21 @@ bool CurlURLInputStream::readMore(int *runningHandles)
break;
default:
- ThrowXMLwithMemMgr1(NetAccessorException, XMLExcepts::NetAcc_InternalError, fURLSource.getURLText(), fMemoryManager);
+ {
+ struct CurlError
+ {
+ XMLCh* fErrorString;
+ MemoryManager* fMemoryManager;
+ CurlError(CURLMsg* msg, MemoryManager* fMemoryManager) : fErrorString(XMLString::transcode(curl_easy_strerror(msg->data.result))), fMemoryManager(fMemoryManager) {}
+ ~CurlError() { XMLString::release(&fErrorString, fMemoryManager); }
+ };
+ CurlError curlErrorStr(msg, fMemoryManager);
+
+ XMLCh curlErrorNumberStr[128];
+ XMLString::binToText(msg->data.result, curlErrorNumberStr, 127, 10, fMemoryManager);
+
+ ThrowXMLwithMemMgr3(NetAccessorException, XMLExcepts::NetAcc_CurlError, fURLSource.getURLText(), curlErrorNumberStr, curlErrorStr.fErrorString, fMemoryManager);
+ }
break;
}
}
---------------------------------------------------------------------
To unsubscribe, e-mail: c-dev-unsubscribe@xerces.apache.org
For additional commands, e-mail: c-dev-help@xerces.apache.org