Ejemplo n.º 1
0
        public void Should_Convert_UserFriendlyException()
        {
            var errorInfo = ErrorInfo.ForException(new UserFriendlyException("Test message"));

            Assert.Equal(0, errorInfo.Code);
            Assert.Equal("Test message", errorInfo.Message);
        }
Ejemplo n.º 2
0
        public void Should_Convert_Specific_Exception()
        {
            var errorInfo = ErrorInfo.ForException(new MySpecificException());

            Assert.Equal(42, errorInfo.Code);
            Assert.Equal("MySpecificMessage", errorInfo.Message);
            Assert.Equal("MySpecificMessageDetails", errorInfo.Details);
        }
        public override void OnException(HttpActionExecutedContext context)
        {
            LogHelper.LogException(context.Exception);

            context.Response = context.Request.CreateResponse(
                HttpStatusCode.OK,
                new AjaxResponse(ErrorInfo.ForException(context.Exception))
                );

            EventBus.Default.Trigger(this, new AbpHandledExceptionData(context.Exception));
        }
Ejemplo n.º 4
0
 private ActionResult GenerateAjaxResult(ExceptionContext context)
 {
     context.HttpContext.Response.StatusCode = 200;
     return(new AbpJsonResult(new MvcAjaxResponse(ErrorInfo.ForException(context.Exception))));
 }
Ejemplo n.º 5
0
 public ErrorViewModel(Exception exception)
 {
     Exception = exception;
     ErrorInfo = ErrorInfo.ForException(exception);
 }