Bugsnag.Library.BugSnag.ProcessExceptions C# (CSharp) Метод

ProcessExceptions() приватный Метод

Process a list of exceptions into an event
private ProcessExceptions ( List exList, string Context, string UserId, object extraData ) : Event
exList List A list of exceptions
Context string The context for the event
UserId string The userId for the event
extraData object
Результат Bugsnag.Library.Data.Event
        private Event ProcessExceptions(List<System.Exception> exList, string Context, string UserId, object extraData)
        {
            //  Create an event to return
            Event retval = new Event()
            {
                AppVersion = this.applicationVersion,
                Context = Context,
                OSVersion = this.OSVersion,
                ReleaseStage = this.releaseStage,
                UserId = UserId,
                ExtraData = extraData
            };

            //  Our list of exceptions:
            List<Bugsnag.Library.Data.Exception> exceptions = new List<Bugsnag.Library.Data.Exception>();

            //  For each exception passed...
            foreach(System.Exception ex in exList)
            {
                //  ... Create a list of stacktraces
                //  This may not be the best way to get this information:
                //  http://blogs.msdn.com/b/jmstall/archive/2005/03/20/399287.aspx
                var stacktraces = (from item in new System.Diagnostics.StackTrace(ex, true).GetFrames()
                                   select new Stacktrace()
                                   {
                                       File = item.GetFileName() ?? item.GetType().Name ?? "N/A",
                                       LineNumber = item.GetFileLineNumber(),
                                       Method = item.GetMethod().Name
                                   }).ToList();

                //  Add a new exception, and use the stacktrace list:
                exceptions.Add(new Bugsnag.Library.Data.Exception()
                {
                    ErrorClass = ex.TargetSite.Name,
                    Message = ex.Message,
                    Stacktrace = stacktraces
                });
            }

            //  Set our list of exceptions
            retval.Exceptions = exceptions;

            //  Return the event:
            return retval;
        }