Throw exception from inside HttpClientSession.Request().
This commit is contained in:
@@ -8,6 +8,8 @@ namespace webcc {
|
||||
|
||||
const char* DescribeError(Error error) {
|
||||
switch (error) {
|
||||
case kSchemaError:
|
||||
return "Schema error";
|
||||
case kHostResolveError:
|
||||
return "Host resolve error";
|
||||
case kEndpointConnectError:
|
||||
@@ -29,4 +31,14 @@ const char* DescribeError(Error error) {
|
||||
}
|
||||
}
|
||||
|
||||
Exception::Exception(Error error, bool timeout, const std::string& details)
|
||||
: error_(error), timeout_(timeout), msg_(DescribeError(error)) {
|
||||
if (timeout) {
|
||||
msg_ += " (timeout)";
|
||||
}
|
||||
if (!details.empty()) {
|
||||
msg_ += " (" + details + ")";
|
||||
}
|
||||
}
|
||||
|
||||
} // namespace webcc
|
||||
|
||||
Reference in New Issue
Block a user