コード例 #1
0
        public void WriteException(Exception ex)
        {
            var uh = new Error(ex);

            uh.ApplicationId = this.CurrentApplication.Id;
            IUnhandledErrorRepository rep = RepositoryFactory.Instance.CreateInstance <IUnhandledErrorRepository>();

            uh = rep.Create(uh);

            var inner = ex.InnerException;

            while (inner != null)
            {
                var uhInner = new Error(inner);
                uhInner.ParentErrorId = uh.Id;
                uhInner.ApplicationId = this.CurrentApplication.Id;
                rep.Create(uhInner);
                inner = inner.InnerException;
            }

            var currentRequest = HttpContext.Current.Request;

            foreach (var cookieKey in currentRequest.Cookies.AllKeys)
            {
                Cookie sc = new Cookie(currentRequest.Cookies[cookieKey]);
                sc.ErrorId = uh.Id;
                IUnhandledCookieRepository crep = RepositoryFactory.Instance.CreateInstance <IUnhandledCookieRepository>();
                crep.Create(sc);
            }
        }
コード例 #2
0
        public void GetMainErrors()
        {
            IUnhandledErrorRepository rep = RepositoryFactory.Instance.CreateInstance <IUnhandledErrorRepository>();
            List <Error> errors           = rep.GetMainErrors();

            Response.RespondObjectAsJson(errors);
        }
コード例 #3
0
        public void GetErrorDetails()
        {
            IUnhandledErrorRepository rep = RepositoryFactory.Instance.CreateInstance <IUnhandledErrorRepository>();
            long id = 0;

            if (!long.TryParse(Request.QueryString["id"], out id))
            {
                throw new ArgumentException();
            }
            Error ue = rep.GetById(id);

            Response.RespondObjectAsJson(ue);
        }