/// <summary>
        /// Sends the given exception to Appfail
        /// </summary>
        /// <param name="e"></param>
        public static void SendToAppfail(this Exception e, HttpContextBase httpContext = null)
        {
            if (e == null)
            {
                return;
            }

            try
            {
                if (httpContext == null)
                {
                    httpContext = new HttpContextWrapper(HttpContext.Current);
                }

                if (ConfigurationModel.Instance.DisableInDebugMode && httpContext.IsDebuggingEnabled)
                {
                    // We are in debug mode, and should disable during debug mode, so exit and don't report the failure.
                    return;
                }

                var url = httpContext.Request.Url.AbsolutePath.ToString();

                // The base exception is the true 'cause' of the error, this is what we report for the
                // exception type, message and stack trace.
                var baseException = e.GetBaseException();

                if (!IsFilteredByFluentExpression(baseException, url) && !IsFilteredByWebConfig(baseException, url))
                {
                    var failReport = FailOccurrenceFactory.FromException(httpContext, e);
                    FailQueue.Enqueue(failReport);
                }
            }
            catch (Exception)
            {
                // Yes this is a catch-all exception, but warranted here. Appfail's reporting module
                // should NEVER cause an unhandled exception. We can't be bringing down client applications.
            }
        }
Exemplo n.º 2
0
        public void ElementF()
        {
            FailQueue q = new FailQueue();

            Assert.Throws <NoElementsException>(() => q.Element());
        }
Exemplo n.º 3
0
        public void RemoveFail()
        {
            FailQueue q = new FailQueue();

            Assert.Throws <NoElementsException>(() => q.Remove());
        }
Exemplo n.º 4
0
        public void AddFail()
        {
            FailQueue q = new FailQueue();

            Assert.Throws <InvalidOperationException>(() => q.Add(Int32.Parse("1")));
        }
        public void ElementF()
        {
            FailQueue q = new FailQueue();

            q.Element();
        }
        public void RemoveFail()
        {
            FailQueue q = new FailQueue();

            q.Remove();
        }
        public void AddFail()
        {
            FailQueue q = new FailQueue();

            q.Add(Int32.Parse("1"));
        }
Exemplo n.º 8
0
		public void ElementF()
		{
			FailQueue q = new FailQueue();
			q.Element();
		}
Exemplo n.º 9
0
		public void RemoveFail()
		{
			FailQueue q = new FailQueue();
			q.Remove();
		}
Exemplo n.º 10
0
		public void AddFail()
		{
			FailQueue q = new FailQueue();
			q.Add(Int32.Parse("1"));
		}
		public void ElementF()
		{
			FailQueue q = new FailQueue();
			Assert.Throws<NoElementsException>(() => q.Element());
		}
		public void RemoveFail()
		{
			FailQueue q = new FailQueue();
			Assert.Throws<NoElementsException>(() => q.Remove());
		}
		public void AddFail()
		{
			FailQueue q = new FailQueue();
			Assert.Throws<InvalidOperationException>(() => q.Add(Int32.Parse("1")));
		}