Beispiel #1
0
        public string OnActionException(HttpActionContext httpRequest, Exception ex)
        {
            var formattedActionException = ActionLevelExceptionManager.GetActionExceptionMessage(httpRequest);

            this.LogError($"[{formattedActionException.ErrorId}]{formattedActionException.ErrorMessage}", ex);

            // TODO: Mail support person who is stated in the Web.config

            return
                ($"(ErrID:{formattedActionException.ErrorId}) {formattedActionException.ErrorMessage} {formattedActionException.KindMessage}");
        }
Beispiel #2
0
        public void Exception_On_Get_Request_Is_Properly_formatted()
        {
            // arrange
            var action = new HttpActionContext(new HttpControllerContext()
            {
                Request = new HttpRequestMessage()
                {
                    Method     = HttpMethod.Get,
                    RequestUri = new Uri(@"http://*****:*****@"Error while trying to perfrom GET request to /api/v1/areas/51BA94F2-CF55-E711-ABC5-001C42F4C661.", result.ErrorMessage);
            Assert.AreEqual(@"Sorry for the inconvinience. Our team was notified so you can try again later.", result.KindMessage);
            Assert.IsTrue(result.ErrorId != string.Empty);
        }