Azavea.Open.Common.Config.ReThrowException C# (CSharp) Method

ReThrowException() protected static method

All the checks for null are because there was an issue where something about a caught exception was null, which caused the error handling code to bomb. Since error handling code is the worst place to bomb (you lose the original exception), to be safe we manually convert null values into "null" strings.
protected static ReThrowException ( string msg, object paramList, Exception orig ) : void
msg string
paramList object
orig System.Exception
return void
        protected static void ReThrowException(string msg, object[] paramList, Exception orig)
        {
            if (msg == null)
            {
                msg = "null message";
            }
            if ((paramList != null) && (paramList.Length > 0))
            {
                msg += " (" + ((paramList[0] == null) ? "null" : paramList[0].ToString());
                for (int x = 1; x < paramList.Length; x++)
                {
                    msg += ", " + ((paramList[x] == null) ? "null" : paramList[x].ToString());
                }
                msg += ")\n";
            }
            if (orig == null)
            {
                msg += "Exception was null.";
            }
            else
            {
                msg += "Exception Message: " + (orig.Message ?? "null") + "\n";
                msg += "Exception StackTrace: " + (orig.StackTrace ?? "null");
            }
            throw new LoggingException(msg);
        }