onexception

Apache Camel onException

被刻印的时光 ゝ 提交于 2020-01-13 09:49:52
问题 I want to catch all Exception from routes. I add this OnExeption : onException(Exception.class).process(new MyFunctionFailureHandler()).stop(); Then, I create the class MyFunctionFailureHandler. public class MyFunctionFailureHandler implements Processor { @Override public void process(Exchange exchange) throws Exception { Throwable caused; caused = exchange.getProperty(Exchange.EXCEPTION_CAUGHT, Throwable.class); exchange.getContext().createProducerTemplate().send("mock:myerror", exchange); }

Web Api REST service exception handling issue

有些话、适合烂在心里 提交于 2019-12-24 16:53:25
问题 I've built a simple REST service using ASP.NET web api. I've associated one of my controller's method with a custom ActionFilterAttribute, overriding it's OnActionExecuted. On the action filter I use the response about to be sent (actionExecutedContext.Response). The whole application is associated with a custom ExceptionFilterAttribute overriding OnException used for logging errors. Now for the problem - when an exception is raised from the controller's method, I've expected one of the two :

Any way to recover model passed to POST action when inside OnException(ExceptionContext filterContext)?

核能气质少年 提交于 2019-12-19 07:01:10
问题 Situation is this: I can't find a way of getting the viewModel that was passed to the POST action method. [HttpPost] public ActionResult Edit(SomeCoolModel viewModel) { // Some Exception happens here during the action execution... } Inside the overridable OnException for the controller: protected override void OnException(ExceptionContext filterContext) { ... filterContext.Result = new ViewResult { ViewName = filterContext.RouteData.Values["action"].ToString(), TempData = filterContext

Camel's CXF component not catching onException(Exception.class)

邮差的信 提交于 2019-12-06 04:14:44
问题 I have a camel-cxf webservice up. I use to handle all SOAP Faults in the CXF's SOAP Fault Interceptor mechanism. That is working well. I thought that its better to handle Exception thrown at the Camel layer at the same layer and wrote a simple onException scenario like this: onException(Exception.class). to("direct:MyWSExceptionHandler"); Whenever a custom exception is thrown, I was expecting the onException to kick in(Remember I also have a SOAP Fault Interceptor too), but it doesn't. The

MVC HttpRequestValidationException exception

ぐ巨炮叔叔 提交于 2019-12-04 05:07:18
问题 I am coding a MVC 5 internet application and have a question in regards to the HttpRequestValidationException exception. My previous code in my controller is as follows: protected override void OnException(ExceptionContext filterContext) { // Make use of the exception later this.Session["ErrorException"] = filterContext.Exception; if (filterContext.Exception is HttpRequestValidationException) { TempData["UITitle"] = "Validation"; TempData["UIHeading"] = customErrorType; TempData["UIMessage"]

MVC HttpRequestValidationException exception

泪湿孤枕 提交于 2019-12-02 04:35:33
I am coding a MVC 5 internet application and have a question in regards to the HttpRequestValidationException exception. My previous code in my controller is as follows: protected override void OnException(ExceptionContext filterContext) { // Make use of the exception later this.Session["ErrorException"] = filterContext.Exception; if (filterContext.Exception is HttpRequestValidationException) { TempData["UITitle"] = "Validation"; TempData["UIHeading"] = customErrorType; TempData["UIMessage"] = filterContext.Exception.Message; TempData["UIException"] = filterContext.Exception; filterContext

ASP.NET MVC Controller.OnException not being called

99封情书 提交于 2019-11-30 19:28:39
I have a base controller class where I'm overriding to the Controller.OnException handler method in order to provide a generic error handling for certain types of controllers that will inherit from this class (these are API controllers that will return JSON results). The OnException method never gets called when an exception gets raised by the controller. Does anyone see what I am doing wrong, or is there a better way to handle this situation? Using MVC 1.0 Base Class: public class APIController : Controller { protected override void OnException(ExceptionContext filterContext) { //This is

ASP.NET MVC Controller.OnException not being called

我怕爱的太早我们不能终老 提交于 2019-11-30 16:57:12
问题 I have a base controller class where I'm overriding to the Controller.OnException handler method in order to provide a generic error handling for certain types of controllers that will inherit from this class (these are API controllers that will return JSON results). The OnException method never gets called when an exception gets raised by the controller. Does anyone see what I am doing wrong, or is there a better way to handle this situation? Using MVC 1.0 Base Class: public class