13#include <zypp-curl/auth/CurlAuthData>
25 , _errorMessage(
std::move(msg) )
26, _extraInfo(
std::move(extraInfo) )
45 std::map<std::string, boost::any> extraInfo;
56 extraInfo.insert( {
"requestUrl", url } );
57 extraInfo.insert( {
"curlCode",
nativeCode } );
68 err +=
" or redirect (";
123 if ( url.
getHost().find(
".suse.com") != std::string::npos )
124 msg403 =
_(
"Visit the SUSE Customer Center to check whether your registration is valid and has not expired.");
125 else if (url.
asString().find(
"novell.com") != std::string::npos)
126 msg403 =
_(
"Visit the Novell Customer Center to check whether your registration is valid and has not expired.");
147 "Unable to retrieve HTTP response\n"), url.
asString().c_str() ) ;
152#if CURLVERSION_AT_LEAST(7,16,0)
210 std::map<std::string, boost::any> extraInfo;
211 extraInfo.insert( {
"curlMCode",
nativeCode } );
215 err =
"The dispatcher returned an unknown error";
232 return d_func()->_errorCode;
237 return d_func()->_errorMessage;
247 return d_func()->_extraInfo;
256 return "Internal Error";
258 return "The request was cancelled";
260 return "The request exceeded the maximum download size";
262 return "The downloaded data did not result in a valid checksum";
264 return "The peer certificate could not be verified";
266 return "Connection failed";
268 return "Unsupported protocol";
272 return "Requested location is temporarily unaccessible.";
274 return "Timeout reached";
276 return "Access to requested URL is forbidden.";
278 return "File not found";
280 return "Authentication required but not provided.";
282 return "Login failed.";
284 return "Server returned an error for the given request.";
286 return "Server did not send all requested ranges.";
288 return "Invalid data from server, multipart was requested but there was no range status code.";
290 return "Server returned a HTTP/2 error.";
292 return "Server returned a HTTP/2 stream error.";
294 return std::string();
302 if (
it !=
d->_extraInfo.end() ) {
304 return boost::any_cast<std::string>(
it->second );
305 }
catch (
const boost::bad_any_cast &) { }
309 if (
it !=
d->_extraInfo.end() ) {
311 return boost::any_cast<std::string>(
it->second );
312 }
catch (
const boost::bad_any_cast &) { }
315 return std::string();
Reference counted access to a Tp object calling a custom Dispose function when the last AutoDispose h...
std::string asString() const
Returns a default string representation of the Url object.
std::string getHost(EEncoding eflag=zypp::url::E_DECODED) const
Returns the hostname or IP from the URL authority.
const char * c_str() const
String representation.
static std::string typeToString(NetworkRequestError::Type t)
NetworkRequestErrorPrivate(NetworkRequestError::Type code, std::string &&msg, std::map< std::string, boost::any > &&extraInfo)
static zyppng::NetworkRequestError fromCurlMError(int nativeCode)
NetworkRequestErrorPrivate * clone() const
static zyppng::NetworkRequestError fromCurlError(NetworkRequest &req, int nativeCode, const std::string &nativeError)
static zyppng::NetworkRequestError customError(NetworkRequestError::Type t, std::string &&errorMsg="", std::map< std::string, boost::any > &&extraInfo={})
The NetworkRequestError class Represents a error that occured in.
std::string toString() const
toString Returns a string representation of the error
const std::map< std::string, boost::any > & extraInfo() const
Type type() const
type Returns the type of the error
std::string nativeErrorString() const
bool isError() const
isError Will return true if this is a actual error
const zypp::Pathname & targetFilePath() const
Returns the target filename path.
void * nativeHandle() const
TransferSettings & transferSettings()
const std::string & lastRedirectInfo() const
std::string numstring(char n, int w=0)
std::string form(const char *format,...) __attribute__((format(printf
Printf style construction of std::string.
std::string asString(const Patch::Category &obj)
constexpr std::string_view CurlNativeErrorDescKey
constexpr std::string_view CurlNativeErrorCodeDescKey
#define ZYPP_IMPL_PRIVATE(Class)