Exemple #1
0
        public override void AddDefaultInformation(ExceptionlessPluginContext context, Error error)
        {
            if (!context.Data.ContainsKey("HttpActionContext"))
            {
                return;
            }

            base.AddDefaultInformation(context, error);

            HttpActionContext actionContext = context.Data.GetHttpActionContext();

            if (actionContext == null)
            {
                return;
            }

            IPrincipal principal = GetPrincipal(actionContext.Request);

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

            try {
                error.AddHttpRequestInfo(actionContext);
            } catch (Exception ex) {
                context.Client.Log.Error(typeof(ExceptionlessWebApiPlugin), ex, "Error adding request info.");
            }
        }
        public override void AddDefaultInformation(ExceptionlessPluginContext context, Error error) {
            if (!context.Data.ContainsKey("HttpActionContext"))
                return;

            base.AddDefaultInformation(context, error);

            HttpActionContext actionContext = context.Data.GetHttpActionContext();
            if (actionContext == null)
                return;

            IPrincipal principal = GetPrincipal(actionContext.Request);
            if (context.Client.Configuration.IncludePrivateInformation
                && principal != null && principal.Identity.IsAuthenticated)
                error.UserName = principal.Identity.Name;

            try {
                error.AddHttpRequestInfo(actionContext);
            } catch (Exception ex) {
                context.Client.Log.Error(typeof(ExceptionlessWebApiPlugin), ex, "Error adding request info.");
            }
        }