Ejemplo n.º 1
0
        public override void AddDefaultInformation(ExceptionlessPluginContext context, Error error)
        {
            base.AddDefaultInformation(context, error);
            error.UserName = null;

            HttpContextBase httpContext = context.Data.GetHttpContext();

            // if the context is not passed in, try and grab it
            if (httpContext == null && HttpContext.Current != null)
            {
                httpContext = new HttpContextWrapper(HttpContext.Current);
            }

            if (httpContext == null)
            {
                return;
            }

            if (context.Client.Configuration.IncludePrivateInformation &&
                httpContext.User != null &&
                httpContext.User.Identity.IsAuthenticated)
            {
                error.UserName = httpContext.User.Identity.Name;
            }

            try {
                error.AddRequestInfo(context.Client, httpContext);
            } catch (Exception ex) {
                context.Client.Log.Error(typeof(ExceptionlessWebPlugin), ex, "Error adding request info.");
            }
        }
        /// <summary>
        /// Adds the current request info to the error.
        /// </summary>
        /// <param name="error">The error model.</param>
        /// <param name="client">The client.</param>
        /// <param name="context">The http context to gather information from.</param>
        public static Error AddRequestInfo(this Error error, ExceptionlessClient client, HttpContext context)
        {
            if (context == null)
            {
                return(error);
            }

            error.AddRequestInfo(client, context.ToWrapped());

            return(error);
        }
        public override void AddDefaultInformation(ExceptionlessPluginContext context, Error error) {
            base.AddDefaultInformation(context, error);

            NancyContext nancyContext = context.Data.GetNancyContext();
            if (nancyContext == null)
                return;

            try {
                error.AddRequestInfo(nancyContext);

                if (nancyContext.CurrentUser != null && context.Client.Configuration.IncludePrivateInformation)
                    error.UserName = nancyContext.CurrentUser.UserName;
            } catch (Exception ex) {
                context.Client.Log.Error(typeof(ExceptionlessNancyPlugin), ex, "Error adding request info.");
            }
        }
        public override void AddDefaultInformation(ExceptionlessPluginContext context, Error error)
        {
            base.AddDefaultInformation(context, error);

            NancyContext nancyContext = context.Data.GetNancyContext();

            if (nancyContext == null)
            {
                return;
            }

            try {
                error.AddRequestInfo(nancyContext);

                if (nancyContext.CurrentUser != null && context.Client.Configuration.IncludePrivateInformation)
                {
                    error.UserName = nancyContext.CurrentUser.UserName;
                }
            } catch (Exception ex) {
                context.Client.Log.Error(typeof(ExceptionlessNancyPlugin), ex, "Error adding request info.");
            }
        }
        public override void AddDefaultInformation(ExceptionlessPluginContext context, Error error) {
            base.AddDefaultInformation(context, error);
            error.UserName = null;

            HttpContextBase httpContext = context.Data.GetHttpContext();

            // if the context is not passed in, try and grab it
            if (httpContext == null && HttpContext.Current != null)
                httpContext = new HttpContextWrapper(HttpContext.Current);

            if (httpContext == null)
                return;

            if (context.Client.Configuration.IncludePrivateInformation
                && httpContext.User != null
                && httpContext.User.Identity.IsAuthenticated)
                error.UserName = httpContext.User.Identity.Name;

            try {
                error.AddRequestInfo(context.Client, httpContext);
            } catch (Exception ex) {
                context.Client.Log.Error(typeof(ExceptionlessWebPlugin), ex, "Error adding request info.");
            }
        }