From 5e9d2f57c82a57307a48afea09aa539b9fa80abf Mon Sep 17 00:00:00 2001
From: Nat Goodspeed <nat@lindenlab.com>
Date: Wed, 17 Aug 2016 11:36:24 -0400
Subject: [PATCH] MAINT-5011: Use LLTHROW() instead of plain
 BOOST_THROW_EXCEPTION().

A level of preprocessor indirection lets us later change the implementation if
desired.
---
 indra/llcommon/lldependencies.cpp             |  4 +-
 indra/llcommon/lleventcoro.cpp                |  4 +-
 indra/llcommon/llevents.cpp                   | 18 +++----
 indra/llcommon/llexception.h                  | 16 +++---
 indra/llcommon/llleap.cpp                     |  6 +--
 indra/llcommon/llprocess.cpp                  | 20 ++++---
 indra/llcommon/llthreadsafequeue.cpp          | 14 ++---
 indra/llcommon/lluuid.cpp                     |  2 +-
 indra/llcommon/tests/wrapllerrs.h             |  3 +-
 indra/llimage/llpngwrapper.cpp                |  9 ++--
 indra/llkdu/llimagej2ckdu.cpp                 |  3 +-
 indra/llmessage/llhttpnode.cpp                |  9 ++--
 indra/llmessage/tests/commtest.h              |  3 +-
 indra/llmessage/tests/networkio.h             |  5 +-
 indra/newview/llappviewer.cpp                 |  3 +-
 indra/newview/llcommandlineparser.cpp         | 17 +++---
 indra/newview/llsecapi.cpp                    |  4 +-
 indra/newview/llsechandler_basic.cpp          | 54 +++++++++----------
 .../updater/llupdatedownloader.cpp            | 11 ++--
 .../updater/llupdateinstaller.cpp             |  3 +-
 .../updater/llupdaterservice.cpp              | 12 ++---
 21 files changed, 104 insertions(+), 116 deletions(-)

diff --git a/indra/llcommon/lldependencies.cpp b/indra/llcommon/lldependencies.cpp
index 87a699ff148..0d5757effdd 100644
--- a/indra/llcommon/lldependencies.cpp
+++ b/indra/llcommon/lldependencies.cpp
@@ -39,8 +39,8 @@
 #include <boost/graph/adjacency_list.hpp>
 #include <boost/graph/topological_sort.hpp>
 #include <boost/graph/exception.hpp>
-#include <boost/throw_exception.hpp>
 // other Linden headers
+#include "llexception.h"
 
 LLDependenciesBase::VertexList LLDependenciesBase::topo_sort(int vertices, const EdgeList& edges) const
 {
@@ -77,7 +77,7 @@ LLDependenciesBase::VertexList LLDependenciesBase::topo_sort(int vertices, const
         // Omit independent nodes: display only those that might contribute to
         // the cycle.
         describe(out, false);
-        BOOST_THROW_EXCEPTION(Cycle(out.str()));
+        LLTHROW(Cycle(out.str()));
     }
     // A peculiarity of boost::topological_sort() is that it emits results in
     // REVERSE topological order: to get the result you want, you must
diff --git a/indra/llcommon/lleventcoro.cpp b/indra/llcommon/lleventcoro.cpp
index f444530a175..56367b8f544 100644
--- a/indra/llcommon/lleventcoro.cpp
+++ b/indra/llcommon/lleventcoro.cpp
@@ -34,12 +34,12 @@
 #include <map>
 // std headers
 // external library headers
-#include <boost/throw_exception.hpp>
 // other Linden headers
 #include "llsdserialize.h"
 #include "llerror.h"
 #include "llcoros.h"
 #include "llmake.h"
+#include "llexception.h"
 
 #include "lleventfilter.h"
 
@@ -352,7 +352,7 @@ LLSD errorException(const LLEventWithID& result, const std::string& desc)
     // returning it, deliver it via exception.
     if (result.second)
     {
-        BOOST_THROW_EXCEPTION(LLErrorEvent(desc, result.first));
+        LLTHROW(LLErrorEvent(desc, result.first));
     }
     // That way, our caller knows a simple return must be from the reply
     // pump (pump 0).
diff --git a/indra/llcommon/llevents.cpp b/indra/llcommon/llevents.cpp
index 50919edb8ed..19d700a3b06 100644
--- a/indra/llcommon/llevents.cpp
+++ b/indra/llcommon/llevents.cpp
@@ -45,7 +45,6 @@
 #include <cctype>
 // external library headers
 #include <boost/range/iterator_range.hpp>
-#include <boost/throw_exception.hpp>
 #if LL_WINDOWS
 #pragma warning (push)
 #pragma warning (disable : 4701) // compiler thinks might use uninitialized var, but no
@@ -58,6 +57,7 @@
 #include "stringize.h"
 #include "llerror.h"
 #include "llsdutil.h"
+#include "llexception.h"
 #if LL_MSVC
 #pragma warning (disable : 4702)
 #endif
@@ -175,7 +175,7 @@ std::string LLEventPumps::registerNew(const LLEventPump& pump, const std::string
     // Unless we're permitted to tweak it, that's Bad.
     if (! tweak)
     {
-        BOOST_THROW_EXCEPTION(LLEventPump::DupPumpName(std::string("Duplicate LLEventPump name '") + name + "'"));
+        LLTHROW(LLEventPump::DupPumpName("Duplicate LLEventPump name '" + name + "'"));
     }
     // The passed name isn't unique, but we're permitted to tweak it. Find the
     // first decimal-integer suffix not already taken. The insert() attempt
@@ -327,9 +327,8 @@ LLBoundListener LLEventPump::listen_impl(const std::string& name, const LLEventL
     // is only when the existing connection object is still connected.
     if (found != mConnections.end() && found->second.connected())
     {
-        BOOST_THROW_EXCEPTION(
-            DupListenerName(std::string("Attempt to register duplicate listener name '") + name +
-                            "' on " + typeid(*this).name() + " '" + getName() + "'"));
+        LLTHROW(DupListenerName("Attempt to register duplicate listener name '" + name +
+                                "' on " + typeid(*this).name() + " '" + getName() + "'"));
     }
     // Okay, name is unique, try to reconcile its dependencies. Specify a new
     // "node" value that we never use for an mSignal placement; we'll fix it
@@ -355,9 +354,8 @@ LLBoundListener LLEventPump::listen_impl(const std::string& name, const LLEventL
         // unsortable. If we leave the new node in mDeps, it will continue
         // to screw up all future attempts to sort()! Pull it out.
         mDeps.remove(name);
-        BOOST_THROW_EXCEPTION(
-            Cycle(std::string("New listener '") + name + "' on " + typeid(*this).name() +
-                  " '" + getName() + "' would cause cycle: " + e.what()));
+        LLTHROW(Cycle("New listener '" + name + "' on " + typeid(*this).name() +
+                      " '" + getName() + "' would cause cycle: " + e.what()));
     }
     // Walk the list to verify that we haven't changed the order.
     float previous = 0.0, myprev = 0.0;
@@ -421,7 +419,7 @@ LLBoundListener LLEventPump::listen_impl(const std::string& name, const LLEventL
             // NOW remove the offending listener node.
             mDeps.remove(name);
             // Having constructed a description of the order change, inform caller.
-            BOOST_THROW_EXCEPTION(OrderChange(out.str()));
+            LLTHROW(OrderChange(out.str()));
         }
         // This node becomes the previous one.
         previous = dmi->second;
@@ -611,7 +609,7 @@ bool LLListenerOrPumpName::operator()(const LLSD& event) const
 {
     if (! mListener)
     {
-        BOOST_THROW_EXCEPTION(Empty("attempting to call uninitialized"));
+        LLTHROW(Empty("attempting to call uninitialized"));
     }
     return (*mListener)(event);
 }
diff --git a/indra/llcommon/llexception.h b/indra/llcommon/llexception.h
index 68bd20fbcd4..e9e25ae6894 100644
--- a/indra/llcommon/llexception.h
+++ b/indra/llcommon/llexception.h
@@ -14,6 +14,7 @@
 
 #include <stdexcept>
 #include <boost/exception/exception.hpp>
+#include <boost/throw_exception.hpp>
 
 // "Found someone who can comfort me
 //  But there are always exceptions..."
@@ -30,12 +31,6 @@
  * all we need to do with an exception is log it, in most places we should
  * catch (...) and log boost::current_exception_diagnostic_information().
  *
- * Please use BOOST_THROW_EXCEPTION()
- * http://www.boost.org/doc/libs/release/libs/exception/doc/BOOST_THROW_EXCEPTION.html
- * to throw viewer exceptions whenever possible. This enriches the exception's
- * diagnostic_information() with the source file, line and containing function
- * of the BOOST_THROW_EXCEPTION() macro.
- *
  * There may be circumstances in which it would be valuable to distinguish an
  * exception explicitly thrown by viewer code from an exception thrown by
  * (say) a third-party library. Catching (const LLException&) supports such
@@ -65,6 +60,15 @@ struct LLContinueError: public LLException
     {}
 };
 
+/**
+ * Please use LLTHROW() to throw viewer exceptions whenever possible. This
+ * enriches the exception's diagnostic_information() with the source file,
+ * line and containing function of the LLTHROW() macro.
+ */
+// Currently we implement that using BOOST_THROW_EXCEPTION(). Wrap it in
+// LLTHROW() in case we ever want to revisit that implementation decision.
+#define LLTHROW(x) BOOST_THROW_EXCEPTION(x)
+
 /// Call this macro from a catch (...) clause
 #define CRASH_ON_UNHANDLED_EXCEPTION() \
      crash_on_unhandled_exception_(__FILE__, __LINE__, __PRETTY_FUNCTION__)
diff --git a/indra/llcommon/llleap.cpp b/indra/llcommon/llleap.cpp
index a8bb9bc53af..c87d2a3e588 100644
--- a/indra/llcommon/llleap.cpp
+++ b/indra/llcommon/llleap.cpp
@@ -21,7 +21,6 @@
 #include <boost/bind.hpp>
 #include <boost/scoped_ptr.hpp>
 #include <boost/tokenizer.hpp>
-#include <boost/throw_exception.hpp>
 // other Linden headers
 #include "llerror.h"
 #include "llstring.h"
@@ -34,6 +33,7 @@
 #include "lltimer.h"
 #include "lluuid.h"
 #include "llleaplistener.h"
+#include "llexception.h"
 
 #if LL_MSVC
 #pragma warning (disable : 4355) // 'this' used in initializer list: yes, intentionally
@@ -70,7 +70,7 @@ class LLLeapImpl: public LLLeap
         // Rule out empty vector
         if (plugin.empty())
         {
-            BOOST_THROW_EXCEPTION(Error("no plugin command"));
+            LLTHROW(Error("no plugin command"));
         }
 
         // Don't leave desc empty either, but in this case, if we weren't
@@ -113,7 +113,7 @@ class LLLeapImpl: public LLLeap
         // If that didn't work, no point in keeping this LLLeap object.
         if (! mChild)
         {
-            BOOST_THROW_EXCEPTION(Error(STRINGIZE("failed to run " << mDesc)));
+            LLTHROW(Error(STRINGIZE("failed to run " << mDesc)));
         }
 
         // Okay, launch apparently worked. Change our mDonePump listener.
diff --git a/indra/llcommon/llprocess.cpp b/indra/llcommon/llprocess.cpp
index ca19c947362..8c321d06b9e 100644
--- a/indra/llcommon/llprocess.cpp
+++ b/indra/llcommon/llprocess.cpp
@@ -34,12 +34,12 @@
 #include "llapr.h"
 #include "apr_signal.h"
 #include "llevents.h"
+#include "llexception.h"
 
 #include <boost/foreach.hpp>
 #include <boost/bind.hpp>
 #include <boost/asio/streambuf.hpp>
 #include <boost/asio/buffers_iterator.hpp>
-#include <boost/throw_exception.hpp>
 #include <iostream>
 #include <stdexcept>
 #include <limits>
@@ -531,9 +531,8 @@ LLProcess::LLProcess(const LLSDOrParams& params):
 
 	if (! params.validateBlock(true))
 	{
-		BOOST_THROW_EXCEPTION(
-			LLProcessError(STRINGIZE("not launched: failed parameter validation\n"
-									 << LLSDNotationStreamer(params))));
+		LLTHROW(LLProcessError(STRINGIZE("not launched: failed parameter validation\n"
+										 << LLSDNotationStreamer(params))));
 	}
 
 	mPostend = params.postend;
@@ -598,11 +597,10 @@ LLProcess::LLProcess(const LLSDOrParams& params):
 		}
 		else
 		{
-			BOOST_THROW_EXCEPTION(
-				LLProcessError(STRINGIZE("For " << params.executable()
-										 << ": unsupported FileParam for " << which
-										 << ": type='" << fparam.type()
-										 << "', name='" << fparam.name() << "'")));
+			LLTHROW(LLProcessError(STRINGIZE("For " << params.executable()
+											 << ": unsupported FileParam for " << which
+											 << ": type='" << fparam.type()
+											 << "', name='" << fparam.name() << "'")));
 		}
 	}
 	// By default, pass APR_NO_PIPE for unspecified slots.
@@ -681,7 +679,7 @@ LLProcess::LLProcess(const LLSDOrParams& params):
 	if (ll_apr_warn_status(apr_proc_create(&mProcess, argv[0], &argv[0], NULL, procattr,
 										   gAPRPoolp)))
 	{
-		BOOST_THROW_EXCEPTION(LLProcessError(STRINGIZE(params << " failed")));
+		LLTHROW(LLProcessError(STRINGIZE(params << " failed")));
 	}
 
 	// arrange to call status_callback()
@@ -1066,7 +1064,7 @@ PIPETYPE& LLProcess::getPipe(FILESLOT slot)
 	PIPETYPE* wp = getPipePtr<PIPETYPE>(error, slot);
 	if (! wp)
 	{
-		BOOST_THROW_EXCEPTION(NoPipe(error));
+		LLTHROW(NoPipe(error));
 	}
 	return *wp;
 }
diff --git a/indra/llcommon/llthreadsafequeue.cpp b/indra/llcommon/llthreadsafequeue.cpp
index a004618e964..491f920c0f9 100644
--- a/indra/llcommon/llthreadsafequeue.cpp
+++ b/indra/llcommon/llthreadsafequeue.cpp
@@ -26,8 +26,8 @@
 #include "linden_common.h"
 #include <apr_pools.h>
 #include <apr_queue.h>
-#include <boost/throw_exception.hpp>
 #include "llthreadsafequeue.h"
+#include "llexception.h"
 
 
 
@@ -42,13 +42,13 @@ LLThreadSafeQueueImplementation::LLThreadSafeQueueImplementation(apr_pool_t * po
 {
 	if(mOwnsPool) {
 		apr_status_t status = apr_pool_create(&mPool, 0);
-		if(status != APR_SUCCESS) BOOST_THROW_EXCEPTION(LLThreadSafeQueueError("failed to allocate pool"));
+		if(status != APR_SUCCESS) LLTHROW(LLThreadSafeQueueError("failed to allocate pool"));
 	} else {
 		; // No op.
 	}
 	
 	apr_status_t status = apr_queue_create(&mQueue, capacity, mPool);
-	if(status != APR_SUCCESS) BOOST_THROW_EXCEPTION(LLThreadSafeQueueError("failed to allocate queue"));
+	if(status != APR_SUCCESS) LLTHROW(LLThreadSafeQueueError("failed to allocate queue"));
 }
 
 
@@ -69,9 +69,9 @@ void LLThreadSafeQueueImplementation::pushFront(void * element)
 	apr_status_t status = apr_queue_push(mQueue, element);
 	
 	if(status == APR_EINTR) {
-		BOOST_THROW_EXCEPTION(LLThreadSafeQueueInterrupt());
+		LLTHROW(LLThreadSafeQueueInterrupt());
 	} else if(status != APR_SUCCESS) {
-		BOOST_THROW_EXCEPTION(LLThreadSafeQueueError("push failed"));
+		LLTHROW(LLThreadSafeQueueError("push failed"));
 	} else {
 		; // Success.
 	}
@@ -89,9 +89,9 @@ void * LLThreadSafeQueueImplementation::popBack(void)
 	apr_status_t status = apr_queue_pop(mQueue, &element);
 
 	if(status == APR_EINTR) {
-		BOOST_THROW_EXCEPTION(LLThreadSafeQueueInterrupt());
+		LLTHROW(LLThreadSafeQueueInterrupt());
 	} else if(status != APR_SUCCESS) {
-		BOOST_THROW_EXCEPTION(LLThreadSafeQueueError("pop failed"));
+		LLTHROW(LLThreadSafeQueueError("pop failed"));
 	} else {
 		return element;
 	}
diff --git a/indra/llcommon/lluuid.cpp b/indra/llcommon/lluuid.cpp
index 785cf479268..d4af2c6b011 100644
--- a/indra/llcommon/lluuid.cpp
+++ b/indra/llcommon/lluuid.cpp
@@ -83,7 +83,7 @@ unsigned int decode( char const * fiveChars ) throw( bad_input_data )
 unsigned int ret = 0;
 for( int ix = 0; ix < 5; ++ix ) {
 char * s = strchr( encodeTable, fiveChars[ ix ] );
-if( s == 0 ) BOOST_THROW_EXCEPTION(bad_input_data());
+if( s == 0 ) LLTHROW(bad_input_data());
 ret = ret * 85 + (s-encodeTable);
 }
 return ret;
diff --git a/indra/llcommon/tests/wrapllerrs.h b/indra/llcommon/tests/wrapllerrs.h
index fa16fd69154..9a4bbbd630d 100644
--- a/indra/llcommon/tests/wrapllerrs.h
+++ b/indra/llcommon/tests/wrapllerrs.h
@@ -40,7 +40,6 @@
 #include <boost/bind.hpp>
 #include <boost/noncopyable.hpp>
 #include <boost/shared_ptr.hpp>
-#include <boost/throw_exception.hpp>
 #include <list>
 #include <string>
 
@@ -79,7 +78,7 @@ struct WrapLLErrs
         error = message;
         // Also throw an appropriate exception since calling code is likely to
         // assume that control won't continue beyond LL_ERRS.
-        BOOST_THROW_EXCEPTION(FatalException(message));
+        LLTHROW(FatalException(message));
     }
 
     std::string error;
diff --git a/indra/llimage/llpngwrapper.cpp b/indra/llimage/llpngwrapper.cpp
index 0b7d4c717f2..640eda7b010 100644
--- a/indra/llimage/llpngwrapper.cpp
+++ b/indra/llimage/llpngwrapper.cpp
@@ -32,7 +32,6 @@
 #include "llpngwrapper.h"
 
 #include "llexception.h"
-#include <boost/throw_exception.hpp>
 
 namespace {
 struct PngError: public LLException
@@ -88,7 +87,7 @@ BOOL LLPngWrapper::isValidPng(U8* src)
 // occurs. We throw PngError and let our try/catch block clean up.
 void LLPngWrapper::errorHandler(png_structp png_ptr, png_const_charp msg)
 {
-	BOOST_THROW_EXCEPTION(PngError(msg));
+	LLTHROW(PngError(msg));
 }
 
 // Called by the libpng library when reading (decoding) the PNG file. We
@@ -138,7 +137,7 @@ BOOL LLPngWrapper::readPng(U8* src, S32 dataSize, LLImageRaw* rawImage, ImageInf
 			this, &errorHandler, NULL);
 		if (mReadPngPtr == NULL)
 		{
-			BOOST_THROW_EXCEPTION(PngError("Problem creating png read structure"));
+			LLTHROW(PngError("Problem creating png read structure"));
 		}
 
 		// Allocate/initialize the memory for image information.
@@ -297,14 +296,14 @@ BOOL LLPngWrapper::writePng(const LLImageRaw* rawImage, U8* dest)
 
 		if (mColorType == -1)
 		{
-			BOOST_THROW_EXCEPTION(PngError("Unsupported image: unexpected number of channels"));
+			LLTHROW(PngError("Unsupported image: unexpected number of channels"));
 		}
 
 		mWritePngPtr = png_create_write_struct(PNG_LIBPNG_VER_STRING,
 			NULL, &errorHandler, NULL);
 		if (!mWritePngPtr)
 		{
-			BOOST_THROW_EXCEPTION(PngError("Problem creating png write structure"));
+			LLTHROW(PngError("Problem creating png write structure"));
 		}
 
 		mWriteInfoPtr = png_create_info_struct(mWritePngPtr);
diff --git a/indra/llkdu/llimagej2ckdu.cpp b/indra/llkdu/llimagej2ckdu.cpp
index fa58931407a..8dd0b6d4585 100644
--- a/indra/llkdu/llimagej2ckdu.cpp
+++ b/indra/llkdu/llimagej2ckdu.cpp
@@ -35,7 +35,6 @@
 #include "kdu_block_coding.h"
 
 #include "llexception.h"
-#include <boost/throw_exception.hpp>
 
 namespace {
 struct KDUError: public LLException
@@ -181,7 +180,7 @@ void LLKDUMessageError::flush(bool end_of_message)
 {
 	if (end_of_message) 
 	{
-		BOOST_THROW_EXCEPTION(KDUError("LLKDUMessageError::flush()"));
+		LLTHROW(KDUError("LLKDUMessageError::flush()"));
 	}
 }
 
diff --git a/indra/llmessage/llhttpnode.cpp b/indra/llmessage/llhttpnode.cpp
index 48ce258ba2d..04b34a296c1 100644
--- a/indra/llmessage/llhttpnode.cpp
+++ b/indra/llmessage/llhttpnode.cpp
@@ -32,7 +32,6 @@
 #include "llstl.h"
 #include "llhttpconstants.h"
 #include "llexception.h"
-#include <boost/throw_exception.hpp>
 
 const std::string CONTEXT_HEADERS("headers");
 const std::string CONTEXT_PATH("path");
@@ -103,19 +102,19 @@ namespace {
 // virtual
 LLSD LLHTTPNode::simpleGet() const
 {
-	BOOST_THROW_EXCEPTION(NotImplemented());
+	LLTHROW(NotImplemented());
 }
 
 // virtual
 LLSD LLHTTPNode::simplePut(const LLSD& input) const
 {
-	BOOST_THROW_EXCEPTION(NotImplemented());
+	LLTHROW(NotImplemented());
 }
 
 // virtual
 LLSD LLHTTPNode::simplePost(const LLSD& input) const
 {
-	BOOST_THROW_EXCEPTION(NotImplemented());
+	LLTHROW(NotImplemented());
 }
 
 
@@ -175,7 +174,7 @@ void LLHTTPNode::del(LLHTTPNode::ResponsePtr response, const LLSD& context) cons
 // virtual
 LLSD LLHTTPNode::simpleDel(const LLSD&) const
 {
-	BOOST_THROW_EXCEPTION(NotImplemented());
+	LLTHROW(NotImplemented());
 }
 
 // virtual
diff --git a/indra/llmessage/tests/commtest.h b/indra/llmessage/tests/commtest.h
index 5dff56b44ff..7c8f27bbd2f 100644
--- a/indra/llmessage/tests/commtest.h
+++ b/indra/llmessage/tests/commtest.h
@@ -38,7 +38,6 @@
 #include <map>
 #include <string>
 #include <boost/lexical_cast.hpp>
-#include <boost/throw_exception.hpp>
 
 struct CommtestError: public LLException
 {
@@ -69,7 +68,7 @@ static int query_port(const std::string& var)
     const char* cport = getenv(var.c_str());
     if (! cport)
     {
-        BOOST_THROW_EXCEPTION(CommtestError(STRINGIZE("missing environment variable" << var)));
+        LLTHROW(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 6aaecf9bac9..5eb739393fe 100644
--- a/indra/llmessage/tests/networkio.h
+++ b/indra/llmessage/tests/networkio.h
@@ -35,7 +35,6 @@
 #include "llpumpio.h"
 #include "llhttpclient.h"
 #include "llexception.h"
-#include <boost/throw_exception.hpp>
 
 /*****************************************************************************
 *   NetworkIO
@@ -53,7 +52,7 @@ class NetworkIO: public LLSingleton<NetworkIO>
         ll_init_apr();
         if (! gAPRPoolp)
         {
-            BOOST_THROW_EXCEPTION(LLException("Can't initialize APR"));
+            LLTHROW(LLException("Can't initialize APR"));
         }
 
         // Create IO Pump to use for HTTP Requests.
@@ -61,7 +60,7 @@ class NetworkIO: public LLSingleton<NetworkIO>
         LLHTTPClient::setPump(*mServicePump);
         if (ll_init_ares() == NULL || !gAres->isInitialized())
         {
-            BOOST_THROW_EXCEPTION(LLException("Can't start DNS resolver"));
+            LLTHROW(LLException("Can't start DNS resolver"));
         }
 
         // You can interrupt pump() without waiting the full timeout duration
diff --git a/indra/newview/llappviewer.cpp b/indra/newview/llappviewer.cpp
index fdef556589a..0eca63da460 100644
--- a/indra/newview/llappviewer.cpp
+++ b/indra/newview/llappviewer.cpp
@@ -132,7 +132,6 @@
 #include <boost/foreach.hpp>
 #include <boost/algorithm/string.hpp>
 #include <boost/regex.hpp>
-#include <boost/throw_exception.hpp>
 
 #if LL_WINDOWS
 #	include <share.h> // For _SH_DENYWR in processMarkerFiles
@@ -5513,7 +5512,7 @@ void LLAppViewer::forceErrorInfiniteLoop()
 void LLAppViewer::forceErrorSoftwareException()
 {
    	LL_WARNS() << "Forcing a deliberate exception" << LL_ENDL;
-    BOOST_THROW_EXCEPTION(LLException("User selected Force Software Exception"));
+    LLTHROW(LLException("User selected Force Software Exception"));
 }
 
 void LLAppViewer::forceErrorDriverCrash()
diff --git a/indra/newview/llcommandlineparser.cpp b/indra/newview/llcommandlineparser.cpp
index 54f96b88729..90a5483dc98 100644
--- a/indra/newview/llcommandlineparser.cpp
+++ b/indra/newview/llcommandlineparser.cpp
@@ -43,7 +43,6 @@
 #include <boost/bind.hpp>
 #include <boost/tokenizer.hpp>
 #include <boost/assign/list_of.hpp>
-#include <boost/throw_exception.hpp>
 
 #if _MSC_VER
 #   pragma warning(pop)
@@ -52,6 +51,7 @@
 #include "llsdserialize.h"
 #include "llerror.h"
 #include "stringize.h"
+#include "llexception.h"
 #include <string>
 #include <set>
 #include <iostream>
@@ -204,17 +204,17 @@ class LLCLPValue : public po::value_semantic_codecvt_helper<char>
     {
         if(gPastLastOption)
         {
-            BOOST_THROW_EXCEPTION(LLCLPLastOption("Don't parse no more!"));
+            LLTHROW(LLCLPLastOption("Don't parse no more!"));
         }
 
         // Error checks. Needed?
         if (!value_store.empty() && !is_composing()) 
         {
-            BOOST_THROW_EXCEPTION(LLCLPError("Non composing value with multiple occurences."));
+            LLTHROW(LLCLPError("Non composing value with multiple occurences."));
         }
         if (new_tokens.size() < min_tokens() || new_tokens.size() > max_tokens())
         {
-            BOOST_THROW_EXCEPTION(LLCLPError("Illegal number of tokens specified."));
+            LLTHROW(LLCLPError("Illegal number of tokens specified."));
         }
         
         if(value_store.empty())
@@ -468,7 +468,7 @@ onevalue(const std::string& option,
     {
         // What does it mean when the user specifies a command-line switch
         // that requires a value, but omits the value? Complain.
-        BOOST_THROW_EXCEPTION(LLCLPError(STRINGIZE("No value specified for --" << option << "!")));
+        LLTHROW(LLCLPError(STRINGIZE("No value specified for --" << option << "!")));
     }
     else if (value.size() > 1)
     {
@@ -486,10 +486,9 @@ void badvalue(const std::string& option,
     // If the user passes an unusable value for a command-line switch, it
     // seems like a really bad idea to just ignore it, even with a log
     // warning.
-    BOOST_THROW_EXCEPTION(
-        LLCLPError(STRINGIZE("Invalid value specified by command-line switch '" << option
-                             << "' for variable '" << varname << "' of type " << type
-                             << ": '" << value << "'")));
+    LLTHROW(LLCLPError(STRINGIZE("Invalid value specified by command-line switch '" << option
+                                 << "' for variable '" << varname << "' of type " << type
+                                 << ": '" << value << "'")));
 }
 
 template <typename T>
diff --git a/indra/newview/llsecapi.cpp b/indra/newview/llsecapi.cpp
index bcb9417820a..933f7bb16e2 100644
--- a/indra/newview/llsecapi.cpp
+++ b/indra/newview/llsecapi.cpp
@@ -29,7 +29,7 @@
 #include "llviewerprecompiledheaders.h"
 #include "llsecapi.h"
 #include "llsechandler_basic.h"
-#include <boost/throw_exception.hpp>
+#include "llexception.h"
 #include <openssl/evp.h>
 #include <openssl/err.h>
 #include <map>
@@ -70,7 +70,7 @@ void initializeSecHandler()
 	}
 	if (!exception_msg.empty())  // an exception was thrown.
 	{
-		BOOST_THROW_EXCEPTION(LLProtectedDataException(exception_msg));
+		LLTHROW(LLProtectedDataException(exception_msg));
 	}
 
 }
diff --git a/indra/newview/llsechandler_basic.cpp b/indra/newview/llsechandler_basic.cpp
index 39ce64ad0ef..183a6253825 100644
--- a/indra/newview/llsechandler_basic.cpp
+++ b/indra/newview/llsechandler_basic.cpp
@@ -35,7 +35,7 @@
 #include "llfile.h"
 #include "lldir.h"
 #include "llviewercontrol.h"
-#include <boost/throw_exception.hpp>
+#include "llexception.h"
 #include <vector>
 #include <ios>
 #include <openssl/ossl_typ.h>
@@ -73,14 +73,14 @@ LLBasicCertificate::LLBasicCertificate(const std::string& pem_cert)
 	if(pem_bio == NULL)
 	{
 		LL_WARNS("SECAPI") << "Could not allocate an openssl memory BIO." << LL_ENDL;
-		BOOST_THROW_EXCEPTION(LLInvalidCertificate(this));
+		LLTHROW(LLInvalidCertificate(this));
 	}
 	mCert = NULL;
 	PEM_read_bio_X509(pem_bio, &mCert, 0, NULL);
 	BIO_free(pem_bio);
 	if (!mCert)
 	{
-		BOOST_THROW_EXCEPTION(LLInvalidCertificate(this));
+		LLTHROW(LLInvalidCertificate(this));
 	}
 }
 
@@ -89,7 +89,7 @@ LLBasicCertificate::LLBasicCertificate(X509* pCert)
 {
 	if (!pCert || !pCert->cert_info)
 	{
-		BOOST_THROW_EXCEPTION(LLInvalidCertificate(this));
+		LLTHROW(LLInvalidCertificate(this));
 	}	
 	mCert = X509_dup(pCert);
 }
@@ -874,22 +874,22 @@ void _validateCert(int validation_policy,
 	// check basic properties exist in the cert
 	if(!current_cert_info.has(CERT_SUBJECT_NAME) || !current_cert_info.has(CERT_SUBJECT_NAME_STRING))
 	{
-		BOOST_THROW_EXCEPTION(LLCertException(cert, "Cert doesn't have a Subject Name"));				
+		LLTHROW(LLCertException(cert, "Cert doesn't have a Subject Name"));
 	}
 	
 	if(!current_cert_info.has(CERT_ISSUER_NAME_STRING))
 	{
-		BOOST_THROW_EXCEPTION(LLCertException(cert, "Cert doesn't have an Issuer Name"));				
+		LLTHROW(LLCertException(cert, "Cert doesn't have an Issuer Name"));
 	}
 	
 	// check basic properties exist in the cert
 	if(!current_cert_info.has(CERT_VALID_FROM) || !current_cert_info.has(CERT_VALID_TO))
 	{
-		BOOST_THROW_EXCEPTION(LLCertException(cert, "Cert doesn't have an expiration period"));				
+		LLTHROW(LLCertException(cert, "Cert doesn't have an expiration period"));
 	}
 	if (!current_cert_info.has(CERT_SHA1_DIGEST))
 	{
-		BOOST_THROW_EXCEPTION(LLCertException(cert, "No SHA1 digest"));
+		LLTHROW(LLCertException(cert, "No SHA1 digest"));
 	}
 
 	if (validation_policy & VALIDATION_POLICY_TIME)
@@ -904,7 +904,7 @@ void _validateCert(int validation_policy,
 		if((validation_date < current_cert_info[CERT_VALID_FROM].asDate()) ||
 		   (validation_date > current_cert_info[CERT_VALID_TO].asDate()))
 		{
-			BOOST_THROW_EXCEPTION(LLCertValidationExpirationException(cert, validation_date));
+			LLTHROW(LLCertValidationExpirationException(cert, validation_date));
 		}
 	}
 	if (validation_policy & VALIDATION_POLICY_SSL_KU)
@@ -915,14 +915,14 @@ void _validateCert(int validation_policy,
 			!(_LLSDArrayIncludesValue(current_cert_info[CERT_KEY_USAGE], 
 									  LLSD((std::string)CERT_KU_KEY_ENCIPHERMENT)))))
 		{
-			BOOST_THROW_EXCEPTION(LLCertKeyUsageValidationException(cert));
+			LLTHROW(LLCertKeyUsageValidationException(cert));
 		}
 		// only validate EKU if the cert has it
 		if(current_cert_info.has(CERT_EXTENDED_KEY_USAGE) && current_cert_info[CERT_EXTENDED_KEY_USAGE].isArray() &&	   
 		   (!_LLSDArrayIncludesValue(current_cert_info[CERT_EXTENDED_KEY_USAGE], 
 									LLSD((std::string)CERT_EKU_SERVER_AUTH))))
 		{
-			BOOST_THROW_EXCEPTION(LLCertKeyUsageValidationException(cert));			
+			LLTHROW(LLCertKeyUsageValidationException(cert));
 		}
 	}
 	if (validation_policy & VALIDATION_POLICY_CA_KU)
@@ -931,7 +931,7 @@ void _validateCert(int validation_policy,
 			(!_LLSDArrayIncludesValue(current_cert_info[CERT_KEY_USAGE], 
 									   (std::string)CERT_KU_CERT_SIGN)))
 			{
-				BOOST_THROW_EXCEPTION(LLCertKeyUsageValidationException(cert));						
+				LLTHROW(LLCertKeyUsageValidationException(cert));
 			}
 	}
 	
@@ -943,13 +943,13 @@ void _validateCert(int validation_policy,
 		if(!current_cert_info[CERT_BASIC_CONSTRAINTS].has(CERT_BASIC_CONSTRAINTS_CA) ||
 		   !current_cert_info[CERT_BASIC_CONSTRAINTS][CERT_BASIC_CONSTRAINTS_CA])
 		{
-				BOOST_THROW_EXCEPTION(LLCertBasicConstraintsValidationException(cert));
+				LLTHROW(LLCertBasicConstraintsValidationException(cert));
 		}
 		if (current_cert_info[CERT_BASIC_CONSTRAINTS].has(CERT_BASIC_CONSTRAINTS_PATHLEN) &&
 			((current_cert_info[CERT_BASIC_CONSTRAINTS][CERT_BASIC_CONSTRAINTS_PATHLEN].asInteger() != 0) &&
 			 (depth > current_cert_info[CERT_BASIC_CONSTRAINTS][CERT_BASIC_CONSTRAINTS_PATHLEN].asInteger())))
 		{
-			BOOST_THROW_EXCEPTION(LLCertBasicConstraintsValidationException(cert));					
+			LLTHROW(LLCertBasicConstraintsValidationException(cert));
 		}
 	}
 }
@@ -1019,7 +1019,7 @@ void LLBasicCertificateStore::validate(int validation_policy,
 
 	if(cert_chain->size() < 1)
 	{
-		BOOST_THROW_EXCEPTION(LLCertException(NULL, "No certs in chain"));
+		LLTHROW(LLCertException(NULL, "No certs in chain"));
 	}
 	iterator current_cert = cert_chain->begin();
 	LLSD 	current_cert_info;
@@ -1034,11 +1034,11 @@ void LLBasicCertificateStore::validate(int validation_policy,
 		(*current_cert)->getLLSD(current_cert_info);
 		if(!validation_params.has(CERT_HOSTNAME))
 		{
-			BOOST_THROW_EXCEPTION(LLCertException((*current_cert), "No hostname passed in for validation"));			
+			LLTHROW(LLCertException((*current_cert), "No hostname passed in for validation"));
 		}
 		if(!current_cert_info.has(CERT_SUBJECT_NAME) || !current_cert_info[CERT_SUBJECT_NAME].has(CERT_NAME_CN))
 		{
-			BOOST_THROW_EXCEPTION(LLInvalidCertificate((*current_cert)));				
+			LLTHROW(LLInvalidCertificate((*current_cert)));
 		}
 		
 		LL_DEBUGS("SECAPI") << "Validating the hostname " << validation_params[CERT_HOSTNAME].asString() << 
@@ -1055,7 +1055,7 @@ void LLBasicCertificateStore::validate(int validation_policy,
 	X509* cert_x509 = (*current_cert)->getOpenSSLX509();
 	if(!cert_x509)
 	{
-		BOOST_THROW_EXCEPTION(LLInvalidCertificate((*current_cert)));			
+		LLTHROW(LLInvalidCertificate((*current_cert)));
 	}
 	std::string sha1_hash((const char *)cert_x509->sha1_hash, SHA_DIGEST_LENGTH);
 	X509_free( cert_x509 );
@@ -1076,7 +1076,7 @@ void LLBasicCertificateStore::validate(int validation_policy,
 			if((validation_date < cache_entry->second.first) ||
 			   (validation_date > cache_entry->second.second))
 			{
-				BOOST_THROW_EXCEPTION(LLCertValidationExpirationException((*current_cert), validation_date));
+				LLTHROW(LLCertValidationExpirationException((*current_cert), validation_date));
 			}
 		}
 		// successfully found in cache
@@ -1108,7 +1108,7 @@ void LLBasicCertificateStore::validate(int validation_policy,
 			if(!_verify_signature((*current_cert),
 								  previous_cert))
 			{
-			   BOOST_THROW_EXCEPTION(LLCertValidationInvalidSignatureException(previous_cert));
+			   LLTHROW(LLCertValidationInvalidSignatureException(previous_cert));
 			}
 		}
 		_validateCert(local_validation_policy,
@@ -1157,7 +1157,7 @@ void LLBasicCertificateStore::validate(int validation_policy,
 			if(!_verify_signature((*found_store_cert),
 								  (*current_cert)))
 			{
-				BOOST_THROW_EXCEPTION(LLCertValidationInvalidSignatureException(*current_cert));
+				LLTHROW(LLCertValidationInvalidSignatureException(*current_cert));
 			}			
 			// successfully validated.
 			mTrustedCertCache[sha1_hash] = std::pair<LLDate, LLDate>(from_time, to_time);		
@@ -1174,7 +1174,7 @@ void LLBasicCertificateStore::validate(int validation_policy,
 	if (validation_policy & VALIDATION_POLICY_TRUSTED)
 	{
 		// we reached the end without finding a trusted cert.
-		BOOST_THROW_EXCEPTION(LLCertValidationTrustException((*cert_chain)[cert_chain->size()-1]));
+		LLTHROW(LLCertValidationTrustException((*cert_chain)[cert_chain->size()-1]));
 
 	}
 	mTrustedCertCache[sha1_hash] = std::pair<LLDate, LLDate>(from_time, to_time);	
@@ -1262,7 +1262,7 @@ void LLSecAPIBasicHandler::_readProtectedData()
 		protected_data_stream.read((char *)salt, STORE_SALT_SIZE);
 		if (protected_data_stream.gcount() < STORE_SALT_SIZE)
 		{
-			BOOST_THROW_EXCEPTION(LLProtectedDataException("Config file too short."));
+			LLTHROW(LLProtectedDataException("Config file too short."));
 		}
 
 		cipher.decrypt(salt, STORE_SALT_SIZE);		
@@ -1302,7 +1302,7 @@ void LLSecAPIBasicHandler::_readProtectedData()
 		if (parser->parse(parse_stream, mProtectedDataMap, 
 						  LLSDSerialize::SIZE_UNLIMITED) == LLSDParser::PARSE_FAILURE)
 		{
-			BOOST_THROW_EXCEPTION(LLProtectedDataException("Config file cannot be decrypted."));
+			LLTHROW(LLProtectedDataException("Config file cannot be decrypted."));
 		}
 	}
 }
@@ -1373,7 +1373,7 @@ void LLSecAPIBasicHandler::_writeProtectedData()
 
 		// EXP-1825 crash in LLSecAPIBasicHandler::_writeProtectedData()
 		// Decided throwing an exception here was overkill until we figure out why this happens
-		//BOOST_THROW_EXCEPTION(LLProtectedDataException("Error writing Protected Data Store"));
+		//LLTHROW(LLProtectedDataException("Error writing Protected Data Store"));
 	}
 
     try
@@ -1388,7 +1388,7 @@ void LLSecAPIBasicHandler::_writeProtectedData()
 
             // EXP-1825 crash in LLSecAPIBasicHandler::_writeProtectedData()
             // Decided throwing an exception here was overkill until we figure out why this happens
-            //BOOST_THROW_EXCEPTION(LLProtectedDataException("Could not overwrite protected data store"));
+            //LLTHROW(LLProtectedDataException("Could not overwrite protected data store"));
         }
 	}
 	catch (...)
@@ -1402,7 +1402,7 @@ void LLSecAPIBasicHandler::_writeProtectedData()
 
 		//crash in LLSecAPIBasicHandler::_writeProtectedData()
 		// Decided throwing an exception here was overkill until we figure out why this happens
-		//BOOST_THROW_EXCEPTION(LLProtectedDataException("Error writing Protected Data Store"));
+		//LLTHROW(LLProtectedDataException("Error writing Protected Data Store"));
 	}
 }
 		
diff --git a/indra/viewer_components/updater/llupdatedownloader.cpp b/indra/viewer_components/updater/llupdatedownloader.cpp
index cd4b108c1a8..04e0395c504 100644
--- a/indra/viewer_components/updater/llupdatedownloader.cpp
+++ b/indra/viewer_components/updater/llupdatedownloader.cpp
@@ -30,7 +30,6 @@
 #include "llexception.h"
 #include <boost/format.hpp>
 #include <boost/lexical_cast.hpp>
-#include <boost/throw_exception.hpp>
 #include <curl/curl.h>
 #include "lldir.h"
 #include "llevents.h"
@@ -468,7 +467,7 @@ void LLUpdateDownloader::Implementation::initializeCurlGet(std::string const & u
 
 	if(!mCurl)
 	{
-		BOOST_THROW_EXCEPTION(DownloadError("failed to initialize curl"));
+		LLTHROW(DownloadError("failed to initialize curl"));
 	}
     throwOnCurlError(curl_easy_setopt(mCurl.get(), CURLOPT_NOSIGNAL, true));
 	throwOnCurlError(curl_easy_setopt(mCurl.get(), CURLOPT_FOLLOWLOCATION, true));
@@ -509,7 +508,7 @@ void LLUpdateDownloader::Implementation::resumeDownloading(size_t startByte)
 	mHeaderList = curl_slist_append(mHeaderList, rangeHeaderFormat.str().c_str());
 	if(mHeaderList == 0)
 	{
-		BOOST_THROW_EXCEPTION(DownloadError("cannot add Range header"));
+		LLTHROW(DownloadError("cannot add Range header"));
 	}
 	throwOnCurlError(curl_easy_setopt(mCurl.get(), CURLOPT_HTTPHEADER, mHeaderList));
 
@@ -525,7 +524,7 @@ void LLUpdateDownloader::Implementation::startDownloading(LLURI const & uri, std
 	mDownloadData["hash"] = hash;
 	mDownloadData["current_version"] = ll_get_version();
 	LLSD path = uri.pathArray();
-	if(path.size() == 0) BOOST_THROW_EXCEPTION(DownloadError("no file path"));
+	if(path.size() == 0) LLTHROW(DownloadError("no file path"));
 	std::string fileName = path[path.size() - 1].asString();
 	std::string filePath = gDirUtilp->getExpandedFilename(LL_PATH_TEMP, fileName);
 	mDownloadData["path"] = filePath;
@@ -548,9 +547,9 @@ void LLUpdateDownloader::Implementation::throwOnCurlError(CURLcode code)
 	if(code != CURLE_OK) {
 		const char * errorString = curl_easy_strerror(code);
 		if(errorString != 0) {
-			BOOST_THROW_EXCEPTION(DownloadError(curl_easy_strerror(code)));
+			LLTHROW(DownloadError(curl_easy_strerror(code)));
 		} else {
-			BOOST_THROW_EXCEPTION(DownloadError("unknown curl error"));
+			LLTHROW(DownloadError("unknown curl error"));
 		}
 	} else {
 		; // No op.
diff --git a/indra/viewer_components/updater/llupdateinstaller.cpp b/indra/viewer_components/updater/llupdateinstaller.cpp
index 9f9a08f5906..1c7629da232 100644
--- a/indra/viewer_components/updater/llupdateinstaller.cpp
+++ b/indra/viewer_components/updater/llupdateinstaller.cpp
@@ -36,7 +36,6 @@
 #pragma warning(disable: 4702)      // disable 'unreachable code' so we can use lexical_cast (really!).
 #endif
 #include <boost/lexical_cast.hpp>
-#include <boost/throw_exception.hpp>
 
 namespace {
 	struct RelocateError: public LLException
@@ -49,7 +48,7 @@ namespace {
 		std::string scriptFile = gDirUtilp->getBaseFileName(path);
 		std::string newPath = gDirUtilp->getExpandedFilename(LL_PATH_TEMP, scriptFile);
 		apr_status_t status = apr_file_copy(path.c_str(), newPath.c_str(), APR_FILE_SOURCE_PERMS, gAPRPoolp);
-		if(status != APR_SUCCESS) BOOST_THROW_EXCEPTION(RelocateError());
+		if(status != APR_SUCCESS) LLTHROW(RelocateError());
 		
 		return newPath;
 	}
diff --git a/indra/viewer_components/updater/llupdaterservice.cpp b/indra/viewer_components/updater/llupdaterservice.cpp
index 0bdd1ede433..1665e41e702 100644
--- a/indra/viewer_components/updater/llupdaterservice.cpp
+++ b/indra/viewer_components/updater/llupdaterservice.cpp
@@ -32,10 +32,10 @@
 #include "lltimer.h"
 #include "llupdatechecker.h"
 #include "llupdateinstaller.h"
+#include "llexception.h"
 
 #include <boost/scoped_ptr.hpp>
 #include <boost/weak_ptr.hpp>
-#include <boost/throw_exception.hpp>
 #include "lldir.h"
 #include "llsdserialize.h"
 #include "llfile.h"
@@ -191,9 +191,8 @@ void LLUpdaterServiceImpl::initialize(const std::string&  channel,
 {
 	if(mIsChecking || mIsDownloading)
 	{
-		BOOST_THROW_EXCEPTION(
-			LLUpdaterService::UsageError("LLUpdaterService::initialize call "
-										 "while updater is running."));
+		LLTHROW(LLUpdaterService::UsageError("LLUpdaterService::initialize call "
+											  "while updater is running."));
 	}
 		
 	mChannel = channel;
@@ -224,9 +223,8 @@ void LLUpdaterServiceImpl::startChecking(bool install_if_ready)
 {
 	if(mChannel.empty() || mVersion.empty())
 	{
-		BOOST_THROW_EXCEPTION(
-			LLUpdaterService::UsageError("Set params before call to "
-										 "LLUpdaterService::startCheck()."));
+		LLTHROW(LLUpdaterService::UsageError("Set params before call to "
+											 "LLUpdaterService::startCheck()."));
 	}
 
 	mIsChecking = true;
-- 
GitLab