Beispiel #1
0
        private static ResponseMessageResult HandleBusinessException(ExceptionHandlerContext context)
        {
            var errorData = new ExceptionResponse()
            {
                StatusCode  = HttpStatusCode.BadRequest,
                Message     = context.Exception.Message,
                ErrorNumber = ((BusinessException)context.Exception).TicketNumber
            };

            var response = context.Request.CreateResponse(errorData);
            var result   = new ResponseMessageResult(response);

            return(result);
        }
Beispiel #2
0
        private static ResponseMessageResult GetResponseMessageResult(
            ExceptionHandlerContext context,
            string errorNumber)
        {
            var errorData = new ExceptionResponse()
            {
                StatusCode  = HttpStatusCode.InternalServerError,
                Message     = "Some unhandled error happened. The error has been logged and will be fixed. We appologise blah blah....",
                ErrorNumber = errorNumber,
                Stack       = context.Exception.StackTrace
            };

            var response = context.Request.CreateResponse(errorData);
            var result   = new ResponseMessageResult(response);

            return(result);
        }