public async Task NotifyAsync(DescriptiveError descriptiveError, Exception unhandledException, string path, ClaimsPrincipal user = null)
        {
            var details = new Dictionary <string, string>()
            {
                { "Path", path },
                { "Descriptive.Message", descriptiveError.Message },
                { "Time", DateTime.UtcNow.ToString("g") }
            };

            if (user != null)
            {
                try
                {
                    var userDetails = await _membership.DescribeUserForErrorAsync(user);

                    foreach (var k in userDetails.Keys)
                    {
                        details[k] = userDetails[k].ToString();
                    }
                }
                catch (Exception exc)
                {
                    details.Add("Membership Unavailable", "Membership detaisl are unavailable, received an Exception: " + exc.Message);

                    // fallback to just dumping raw claims
                    foreach (var claim in user.Claims)
                    {
                        details.Add("User.Claims." + claim.Type, claim.Value);
                    }
                }
            }

            await ReportAsync(details, ExceptionToHandle.FromException(unhandledException));
        }
        private DescriptiveError GetDescriptiveError(Exception error)
        {
            var descriptiveError = new DescriptiveError("An internal error has occurred");

            // add details if available

            return(descriptiveError);
        }
        private DescriptiveError GetDescriptiveError(AnonymousError error)
        {
            var err = new DescriptiveError(error.DisplayedMessage);

            err.AdditionalDetails.Add("File", error.File);
            err.AdditionalDetails.Add("Function", error.Function);
            err.AdditionalDetails.Add("Error", error.Error);
            return(err);
        }
Exemple #4
0
 private void AppendAdditionalDetails(DescriptiveError descriptiveError, Dictionary <string, string> details)
 {
     if (descriptiveError.AdditionalDetails != null)
     {
         foreach (var kvp in descriptiveError.AdditionalDetails)
         {
             details.Add(kvp.Key, kvp.Value);
         }
     }
 }
Exemple #5
0
        public async Task NotifyAsync(DescriptiveError descriptiveError, bool isClientSide, ClaimsPrincipal user = null)
        {
            var details = new Dictionary <string, string>()
            {
                { "IsClientSide", isClientSide.ToString() },
                { "Descriptive.Message", descriptiveError.Message },
                { "Time", DateTime.UtcNow.ToString("g") }
            };

            await AppendUserAsync(user, details);

            AppendAdditionalDetails(descriptiveError, details);


            await ReportAsync(details);
        }
Exemple #6
0
        public async Task NotifyAsync(DescriptiveError descriptiveError, Exception unhandledException, string path, ClaimsPrincipal user = null)
        {
            var details = new Dictionary <string, string>()
            {
                { "IsClientSide", "false" },
                { "Path", path },
                { "Descriptive.Message", descriptiveError.Message },
                { "Time", DateTime.UtcNow.ToString("g") }
            };

            await AppendUserAsync(user, details);

            AppendAdditionalDetails(descriptiveError, details);

            await ReportAsync(details, ExceptionToHandle.FromException(unhandledException));
        }