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

Notify() публичный Метод

Gathers information for the last error (if any error is available) and reports it to BugSnag using information from the application configuration file and other defaults
public Notify ( object extraData ) : void
extraData object Any extra data to pass when reporting this error
Результат void
        public void Notify(object extraData)
        {
            //  If we're a web application, we can report errors automagically
            if(HttpContext.Current != null)
            {
                //  If we have errors...
                if (HttpContext.Current.AllErrors != null && HttpContext.Current.AllErrors.Any())
                {
                    //  ... go through all of the errors and report them
                    List<Event> events = new List<Event>();
                    events.Add(ProcessExceptions(
                        HttpContext.Current.AllErrors.ToList(),
                        HttpContext.Current.Request.Path,
                        GetDefaultUserId(),
                        extraData)
                    );

                    //  Send the notification:
                    ErrorNotification notification = new ErrorNotification()
                    {
                        Api_Key = this.apiKey,
                        Events = events
                    };

                    SendNotification(notification, this.useSSL);
                }
            }

            //  If we're not a web application, we're SOL ATM (call another method)
        }

Same methods

BugSnag::Notify ( ) : void
BugSnag::Notify ( List exList, object extraData ) : void
BugSnag::Notify ( List exList, string userId, string context, object extraData ) : void
BugSnag::Notify ( System ex, object extraData ) : void
BugSnag::Notify ( System ex, string userId, string context, object extraData ) : void

Usage Example

Пример #1
0
        //  Added for the BugSnag sample web application
        protected void Application_Error(object sender, EventArgs e)
        {
            //  Create a new BugSnag notifier
            BugSnag bs = new BugSnag();

            //  Notify.  This will get configuration from the web.config
            //  and gather all known errors and report them.  It's just that simple!
            bs.Notify();
        }