Beispiel #1
0
        public static WebHookError FromError(ErrorPipelineContext ctx, IProjectRepository projectRepository, IErrorStackRepository errorStackRepository, IOrganizationRepository organizationRepository) {
            if (ctx == null || ctx.Error == null)
                throw new ArgumentNullException("ctx");

            if (projectRepository == null)
                throw new ArgumentNullException("projectRepository");

            if (errorStackRepository == null)
                throw new ArgumentNullException("errorStackRepository");

            if (organizationRepository == null)
                throw new ArgumentNullException("organizationRepository");

            var project = projectRepository.GetByIdCached(ctx.Error.ProjectId);
            if (project == null)
                throw new ArgumentException("ProjectId not found.");

            var organization = organizationRepository.GetByIdCached(ctx.Error.OrganizationId);
            if (organization == null)
                throw new ArgumentException("OrganizationId not found.");

            var errorStack = errorStackRepository.GetByIdCached(ctx.Error.ErrorStackId);
            if (errorStack == null)
                throw new ArgumentException("ErrorStackId not found.");

            return new WebHookError {
                Id = ctx.Error.Id,
                OccurrenceDate = ctx.Error.OccurrenceDate,
                Tags = ctx.Error.Tags,
                MachineName = ctx.Error.EnvironmentInfo != null ? ctx.Error.EnvironmentInfo.MachineName : null,
                RequestPath = ctx.Error.RequestInfo != null ? ctx.Error.RequestInfo.GetFullPath() : null,
                IpAddress = ctx.Error.RequestInfo != null ? ctx.Error.RequestInfo.ClientIpAddress : ctx.Error.EnvironmentInfo != null ? ctx.Error.EnvironmentInfo.IpAddress : null,
                Message = ctx.Error.Message,
                Type = ctx.Error.Type,
                Code = ctx.Error.Code,
                TargetMethod = ctx.Error.TargetMethod != null ? ctx.Error.TargetMethod.FullName : null,
                ProjectId = ctx.Error.ProjectId,
                ProjectName = project.Name,
                OrganizationId = ctx.Error.OrganizationId,
                OrganizationName = organization.Name,
                ErrorStackId = ctx.Error.ErrorStackId,
                ErrorStackTitle = errorStack.Title,
                ErrorStackDescription = errorStack.Description,
                ErrorStackTags = errorStack.Tags,
                TotalOccurrences = errorStack.TotalOccurrences,
                FirstOccurrence = errorStack.FirstOccurrence,
                LastOccurrence = errorStack.LastOccurrence,
                DateFixed = errorStack.DateFixed,
                IsRegression = ctx.IsRegression,
                IsNew = ctx.IsNew
            };
        }
Beispiel #2
0
        public ActionResult Notification(string stackId, string errorId)
        {
            if (String.IsNullOrEmpty(stackId) || String.IsNullOrEmpty(errorId))
            {
                return(RedirectToAction("Index", "Project"));
            }

            Error error = _repository.GetByIdCached(errorId);

            if (error != null)
            {
                return(RedirectToAction("Index", new { id = errorId }));
            }

            ErrorStack stack = _errorStackRepository.GetByIdCached(stackId);

            if (stack != null && User.CanAccessOrganization(stack.OrganizationId))
            {
                return(View("OccurrenceNotFound", stack));
            }

            return(HttpNotFound("An error with this id was not found."));
        }
Beispiel #3
0
        public static WebHookError FromError(ErrorPipelineContext ctx, IProjectRepository projectRepository, IErrorStackRepository errorStackRepository, IOrganizationRepository organizationRepository)
        {
            if (ctx == null || ctx.Error == null)
            {
                throw new ArgumentNullException("ctx");
            }

            if (projectRepository == null)
            {
                throw new ArgumentNullException("projectRepository");
            }

            if (errorStackRepository == null)
            {
                throw new ArgumentNullException("errorStackRepository");
            }

            if (organizationRepository == null)
            {
                throw new ArgumentNullException("organizationRepository");
            }

            var project = projectRepository.GetByIdCached(ctx.Error.ProjectId);

            if (project == null)
            {
                throw new ArgumentException("ProjectId not found.");
            }

            var organization = organizationRepository.GetByIdCached(ctx.Error.OrganizationId);

            if (organization == null)
            {
                throw new ArgumentException("OrganizationId not found.");
            }

            var errorStack = errorStackRepository.GetByIdCached(ctx.Error.ErrorStackId);

            if (errorStack == null)
            {
                throw new ArgumentException("ErrorStackId not found.");
            }

            return(new WebHookError {
                Id = ctx.Error.Id,
                OccurrenceDate = ctx.Error.OccurrenceDate,
                Tags = ctx.Error.Tags,
                MachineName = ctx.Error.EnvironmentInfo != null ? ctx.Error.EnvironmentInfo.MachineName : null,
                RequestPath = ctx.Error.RequestInfo != null?ctx.Error.RequestInfo.GetFullPath() : null,
                                  IpAddress = ctx.Error.RequestInfo != null ? ctx.Error.RequestInfo.ClientIpAddress : ctx.Error.EnvironmentInfo != null ? ctx.Error.EnvironmentInfo.IpAddress : null,
                                  Message = ctx.Error.Message,
                                  Type = ctx.Error.Type,
                                  Code = ctx.Error.Code,
                                  TargetMethod = ctx.Error.TargetMethod != null ? ctx.Error.TargetMethod.FullName : null,
                                  ProjectId = ctx.Error.ProjectId,
                                  ProjectName = project.Name,
                                  OrganizationId = ctx.Error.OrganizationId,
                                  OrganizationName = organization.Name,
                                  ErrorStackId = ctx.Error.ErrorStackId,
                                  ErrorStackTitle = errorStack.Title,
                                  ErrorStackDescription = errorStack.Description,
                                  ErrorStackTags = errorStack.Tags,
                                  TotalOccurrences = errorStack.TotalOccurrences,
                                  FirstOccurrence = errorStack.FirstOccurrence,
                                  LastOccurrence = errorStack.LastOccurrence,
                                  DateFixed = errorStack.DateFixed,
                                  IsRegression = ctx.IsRegression,
                                  IsNew = ctx.IsNew
            });
        }