summaryrefslogtreecommitdiff
path: root/indra/llcorehttp/httpcommon.cpp
diff options
context:
space:
mode:
authorMonty Brandenberg <monty@lindenlab.com>2013-09-11 19:21:31 -0400
committerMonty Brandenberg <monty@lindenlab.com>2013-09-11 19:21:31 -0400
commit622eae65551df9a4ca6843a6a657777ff5e2140e (patch)
tree28e740af2ca9371b49762042cac3634357c3dfa6 /indra/llcorehttp/httpcommon.cpp
parent2e8e40cf7974a4ab6ca13d264104dbb8b80419b7 (diff)
SH-4490 More 'humane' error code presentation from llcorehttp callers
Added toTerseString() conversion on HttpStatus to generate a string that's more descriptive than the hex value of the HttpStatus value but still forms a short, searchable token (e.g. "Http_503" or "Core_7"). Using this throughout the viewer now, no live cases of toHex(), I believe.
Diffstat (limited to 'indra/llcorehttp/httpcommon.cpp')
-rwxr-xr-xindra/llcorehttp/httpcommon.cpp42
1 files changed, 41 insertions, 1 deletions
diff --git a/indra/llcorehttp/httpcommon.cpp b/indra/llcorehttp/httpcommon.cpp
index f2fcbf77a3..ca57a18578 100755
--- a/indra/llcorehttp/httpcommon.cpp
+++ b/indra/llcorehttp/httpcommon.cpp
@@ -4,7 +4,7 @@
*
* $LicenseInfo:firstyear=2012&license=viewerlgpl$
* Second Life Viewer Source Code
- * Copyright (C) 2012, Linden Research, Inc.
+ * Copyright (C) 2012-2013, Linden Research, Inc.
*
* This library is free software; you can redistribute it and/or
* modify it under the terms of the GNU Lesser General Public
@@ -174,6 +174,46 @@ std::string HttpStatus::toString() const
}
return std::string("Unknown error");
}
+
+
+std::string HttpStatus::toTerseString() const
+{
+ std::ostringstream result;
+
+ unsigned int error_value((unsigned short) mStatus);
+
+ switch (mType)
+ {
+ case EXT_CURL_EASY:
+ result << "Easy_";
+ break;
+
+ case EXT_CURL_MULTI:
+ result << "Multi_";
+ break;
+
+ case LLCORE:
+ result << "Core_";
+ break;
+
+ default:
+ if (isHttpStatus())
+ {
+ result << "Http_";
+ error_value = mType;
+ }
+ else
+ {
+ result << "Unknown_";
+ }
+ break;
+ }
+
+ result << error_value;
+ return result.str();
+}
+
+
} // end namespace LLCore