summaryrefslogtreecommitdiff
path: root/indra/llmessage/tests
diff options
context:
space:
mode:
authorNat Goodspeed <nat@lindenlab.com>2016-07-19 16:25:25 -0400
committerNat Goodspeed <nat@lindenlab.com>2016-07-19 16:25:25 -0400
commit9c49a6c91dd9b5bbe811fcd91d8992ed6bac33e7 (patch)
treeac1d2b5683b0df287448373b79092981115d9410 /indra/llmessage/tests
parent47d93e4f65493977217cfed53ff68eb926cf9bb7 (diff)
MAINT-5011: Introduce LLException base class for viewer exceptions.
This also introduces LLContinueError for exceptions which should interrupt some part of viewer processing (e.g. the current coroutine) but should attempt to let the viewer session proceed. Derive all existing viewer exception classes from LLException rather than from std::runtime_error or std::logic_error. Use BOOST_THROW_EXCEPTION() rather than plain 'throw' to enrich the thrown exception with source file, line number and containing function.
Diffstat (limited to 'indra/llmessage/tests')
-rw-r--r--indra/llmessage/tests/commtest.h9
-rw-r--r--indra/llmessage/tests/networkio.h6
2 files changed, 9 insertions, 6 deletions
diff --git a/indra/llmessage/tests/commtest.h b/indra/llmessage/tests/commtest.h
index 0d149b5258..5dff56b44f 100644
--- a/indra/llmessage/tests/commtest.h
+++ b/indra/llmessage/tests/commtest.h
@@ -33,15 +33,16 @@
#include "llevents.h"
#include "llsd.h"
#include "llhost.h"
+#include "llexception.h"
#include "stringize.h"
#include <map>
#include <string>
-#include <stdexcept>
#include <boost/lexical_cast.hpp>
+#include <boost/throw_exception.hpp>
-struct CommtestError: public std::runtime_error
+struct CommtestError: public LLException
{
- CommtestError(const std::string& what): std::runtime_error(what) {}
+ CommtestError(const std::string& what): LLException(what) {}
};
static bool query_verbose()
@@ -68,7 +69,7 @@ static int query_port(const std::string& var)
const char* cport = getenv(var.c_str());
if (! cport)
{
- throw CommtestError(STRINGIZE("missing environment variable" << var));
+ BOOST_THROW_EXCEPTION(CommtestError(STRINGIZE("missing environment variable" << var)));
}
// This will throw, too, if the value of PORT isn't numeric.
int port(boost::lexical_cast<int>(cport));
diff --git a/indra/llmessage/tests/networkio.h b/indra/llmessage/tests/networkio.h
index 2aff90ca1e..6aaecf9bac 100644
--- a/indra/llmessage/tests/networkio.h
+++ b/indra/llmessage/tests/networkio.h
@@ -34,6 +34,8 @@
#include "llares.h"
#include "llpumpio.h"
#include "llhttpclient.h"
+#include "llexception.h"
+#include <boost/throw_exception.hpp>
/*****************************************************************************
* NetworkIO
@@ -51,7 +53,7 @@ public:
ll_init_apr();
if (! gAPRPoolp)
{
- throw std::runtime_error("Can't initialize APR");
+ BOOST_THROW_EXCEPTION(LLException("Can't initialize APR"));
}
// Create IO Pump to use for HTTP Requests.
@@ -59,7 +61,7 @@ public:
LLHTTPClient::setPump(*mServicePump);
if (ll_init_ares() == NULL || !gAres->isInitialized())
{
- throw std::runtime_error("Can't start DNS resolver");
+ BOOST_THROW_EXCEPTION(LLException("Can't start DNS resolver"));
}
// You can interrupt pump() without waiting the full timeout duration