Codechange: [Network] Let NetworkError return its std::string instead of a C-string
This commit is contained in:
@@ -76,7 +76,7 @@ bool NetworkError::IsConnectInProgress() const
|
|||||||
* Get the string representation of the error message.
|
* Get the string representation of the error message.
|
||||||
* @return The string representation that will get overwritten by next calls.
|
* @return The string representation that will get overwritten by next calls.
|
||||||
*/
|
*/
|
||||||
const char *NetworkError::AsString() const
|
const std::string &NetworkError::AsString() const
|
||||||
{
|
{
|
||||||
if (this->message.empty()) {
|
if (this->message.empty()) {
|
||||||
#if defined(_WIN32)
|
#if defined(_WIN32)
|
||||||
@@ -97,7 +97,7 @@ const char *NetworkError::AsString() const
|
|||||||
this->message.assign(strerror(this->error));
|
this->message.assign(strerror(this->error));
|
||||||
#endif
|
#endif
|
||||||
}
|
}
|
||||||
return this->message.c_str();
|
return this->message;
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
@@ -29,7 +29,7 @@ public:
|
|||||||
bool WouldBlock() const;
|
bool WouldBlock() const;
|
||||||
bool IsConnectionReset() const;
|
bool IsConnectionReset() const;
|
||||||
bool IsConnectInProgress() const;
|
bool IsConnectInProgress() const;
|
||||||
const char *AsString() const;
|
const std::string &AsString() const;
|
||||||
|
|
||||||
static NetworkError GetLast();
|
static NetworkError GetLast();
|
||||||
};
|
};
|
||||||
|
Reference in New Issue
Block a user