예제 #1
0
        private static WrapperException CreateWrapperException(string logString, string stackTrace, LogType type)
        {
            var exception = new WrapperException();

            exception.SetWrapperSdkName(GetExceptionWrapperSdkName());

            string sanitizedLogString = logString.Replace("\n", " ");

            exception.SetMessage(sanitizedLogString);
            exception.SetType(type.ToString());

            string[] stacktraceLines  = stackTrace.Split('\n');
            string   stackTraceString = "";

            foreach (string line in stacktraceLines)
            {
                if (line.Length > 0)
                {
                    stackTraceString += "at " + line + "\n";
                }
            }
            exception.SetStacktrace(stackTraceString);

            return(exception);
        }
예제 #2
0
        private static WrapperException CreateWrapperException(Exception exception)
        {
            var exceptionWrapper = new WrapperException();

            exceptionWrapper.SetWrapperSdkName(GetExceptionWrapperSdkName());
            exceptionWrapper.SetStacktrace(exception.StackTrace);
            exceptionWrapper.SetMessage(exception.Message);
            exceptionWrapper.SetType(exception.GetType().ToString());

            if (exception.InnerException != null)
            {
                var innerExceptionWrapper = CreateWrapperException(exception.InnerException).GetRawObject();
                exceptionWrapper.SetInnerException(innerExceptionWrapper);
            }

            return(exceptionWrapper);
        }