Website openantrag.de
You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
 
 
 
 
OpenAntrag/OpenAntragLib/Attributes/HandleErrorAsJsonAttribute.vb

20 lines
568 B

Imports System.Web.Mvc
Public Class HandleErrorAsJsonAttribute
Inherits FilterAttribute
Implements IExceptionFilter
Public Sub OnException(filterContext As ExceptionContext) Implements IExceptionFilter.OnException
filterContext.ExceptionHandled = True
filterContext.Result = New JsonResult() With {
.Data = New With {
.success = False,
.error = filterContext.Exception.Message
},
.JsonRequestBehavior = JsonRequestBehavior.AllowGet
}
End Sub
End Class