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 (";
126 if ( url.
getHost().find(
".suse.com") != std::string::npos )
127 msg403 =
_(
"Visit the SUSE Customer Center to check whether your registration is valid and has not expired.");
128 else if (url.
asString().find(
"novell.com") != std::string::npos)
129 msg403 =
_(
"Visit the Novell Customer Center to check whether your registration is valid and has not expired.");
150 "Unable to retrieve HTTP response\n"), url.
asString().c_str() ) ;
155#if CURLVERSION_AT_LEAST(7,16,0)
213 std::map<std::string, boost::any> extraInfo;
214 extraInfo.insert( {
"curlMCode",
nativeCode } );
218 err =
"The dispatcher returned an unknown error";
235 return d_func()->_errorCode;
240 return d_func()->_errorMessage;
250 return d_func()->_extraInfo;
259 return "Internal Error";
261 return "The request was cancelled";
263 return "The request exceeded the maximum download size";
265 return "The downloaded data did not result in a valid checksum";
267 return "The peer certificate could not be verified";
269 return "Connection failed";
271 return "Unsupported protocol";
275 return "Requested location is temporarily unaccessible.";
277 return "Timeout reached";
279 return "Access to requested URL is forbidden.";
281 return "File not found";
283 return "Authentication required but not provided.";
285 return "Login failed.";
287 return "Server returned an error for the given request.";
289 return "Server did not send all requested ranges.";
291 return "Invalid data from server, multipart was requested but there was no range status code.";
293 return "Server returned a HTTP/2 error.";
295 return "Server returned a HTTP/2 stream error.";
297 return std::string();
305 if (
it !=
d->_extraInfo.end() ) {
307 return boost::any_cast<std::string>(
it->second );
308 }
catch (
const boost::bad_any_cast &) { }
312 if (
it !=
d->_extraInfo.end() ) {
314 return boost::any_cast<std::string>(
it->second );
315 }
catch (
const boost::bad_any_cast &) { }
318 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)