summaryrefslogtreecommitdiff
path: root/indra/llcommon/lleventapi.cpp
diff options
context:
space:
mode:
authorNat Goodspeed <nat@lindenlab.com>2011-09-07 15:36:45 -0400
committerNat Goodspeed <nat@lindenlab.com>2011-09-07 15:36:45 -0400
commitde2b7cd28c8e8669291b7ca21ecc9602f2044eeb (patch)
treeef49168d82db407383c64ea1d4f21f96512b15e0 /indra/llcommon/lleventapi.cpp
parent8c6f752982e83a50e328b9c83f762721f38836d7 (diff)
parentb59c0a668009e696295a194e118b91469b09d32e (diff)
Automated merge with ssh://hg.lindenlab.com/nat/viewer-storm-1541
Diffstat (limited to 'indra/llcommon/lleventapi.cpp')
-rw-r--r--indra/llcommon/lleventapi.cpp30
1 files changed, 30 insertions, 0 deletions
diff --git a/indra/llcommon/lleventapi.cpp b/indra/llcommon/lleventapi.cpp
index 4270c8b511..ff5459c1eb 100644
--- a/indra/llcommon/lleventapi.cpp
+++ b/indra/llcommon/lleventapi.cpp
@@ -34,6 +34,7 @@
// std headers
// external library headers
// other Linden headers
+#include "llerror.h"
LLEventAPI::LLEventAPI(const std::string& name, const std::string& desc, const std::string& field):
lbase(name, field),
@@ -45,3 +46,32 @@ LLEventAPI::LLEventAPI(const std::string& name, const std::string& desc, const s
LLEventAPI::~LLEventAPI()
{
}
+
+LLEventAPI::Response::Response(const LLSD& seed, const LLSD& request, const LLSD::String& replyKey):
+ mResp(seed),
+ mReq(request),
+ mKey(replyKey)
+{}
+
+LLEventAPI::Response::~Response()
+{
+ // When you instantiate a stack Response object, if the original
+ // request requested a reply, send it when we leave this block, no
+ // matter how.
+ sendReply(mResp, mReq, mKey);
+}
+
+void LLEventAPI::Response::warn(const std::string& warning)
+{
+ LL_WARNS("LLEventAPI::Response") << warning << LL_ENDL;
+ mResp["warnings"].append(warning);
+}
+
+void LLEventAPI::Response::error(const std::string& error)
+{
+ // Use LL_WARNS rather than LL_ERROR: we don't want the viewer to shut
+ // down altogether.
+ LL_WARNS("LLEventAPI::Response") << error << LL_ENDL;
+
+ mResp["error"] = error;
+}