exception-handling

Uncaught Exception Handling in JSF

柔情痞子 提交于 2019-12-06 05:37:02
I am trying to create a filter to handle exceptions (see Handling Uncaught Exception in JSF ) public void doFilter(ServletRequest request, ServletResponse response, FilterChain chain) throws IOException, ServletException { try { log.info("check filter is running"); chain.doFilter(request, response); } catch (Exception e) { log.error("Uncaught exception",e); request.setAttribute("exception", e); request.getRequestDispatcher("/error.xhtml").forward(request, response); } } I execute the following method: <p:commandButton value="Dispatch Order" update="@form" action="#{orderBean.dispatchOrder()}">

How to check ErrorCode for REGDB_E_CLASSNOTREG?

旧城冷巷雨未停 提交于 2019-12-06 05:31:45
try { // call to Com Method } catch (COMException e) { if (e.ErrorCode == 0x80040154) // REGDB_E_CLASSNOTREG. { // handle this error. } } I would like to check if com exception is thrown due to REGDB_E_CLASSNOTREG then handle it. I tried with the code above but it gives warning: Comparison to integral constant is useless; the constant is outside the range of type 'int' I believe this error is due to 0x80040154 is not in Int32 range. Can you suggest any possible solution? or Is there any other way to check this? Use the unchecked keyword: catch (COMException ex) { if (ex.ErrorCode == unchecked(

ASP.NET – Error throwing or logging

此生再无相见时 提交于 2019-12-06 05:23:19
We are building an ASP.NET application in C# We have 3 layers: UI, Business and Database. We need clarification on error handling/logging. We have a error logging framework to log errors. My question is: do we need to log errors in each layer or only in the main calling layer (UI layer) by throwing the errors to UI layer from business and database layers? Is there a best practice? If would be great if you could also provide a reference document or web references (If needed). Thanks and Regards … Sruthi Keerthi. Handle any exceptions that you can in the layer that they occur. Let the ones that

Scala Continuations - Why can't my shifted call be inside a try-catch block?

╄→гoц情女王★ 提交于 2019-12-06 05:06:26
问题 I'm new to Scala continuations, and relatively new to the scala language in general. I tried playing with Scala continuations and wrote the following code: case class MyException(msg:String) extends Exception def go:Int = reset { println("enter your input") val my_check = //try { val user_input = readLine() if (!user_input.matches("\\w+")) { throw new MyException("illegal string: " + user_input) } shift { k: (Boolean => Int) => { if (user_input == "true") { k(true) } else if (user_input ==

How default exception handler work

随声附和 提交于 2019-12-06 05:00:37
When we try to run the following program then we get the error that Exception in thread "main" java.lang.ArithmeticException: / by zero class excp { public static void main(String args[]) { int x = 0; int a = 30/x; } } but when we ask somebody how these works, then he tell me that this exception is cautch by the default exception handler, So i could't understand how this defualt exception handler works. Plz elaborate this. Quoting JLS 11 : 30/x - violates the semantic constraint of Java Language - hence the exception will occur. If no catch clause that can handle an exception can be found,

Spring Web Flow Preventing Back Button Use

此生再无相见时 提交于 2019-12-06 04:43:22
问题 So I'm using Spring Web Flow on a project and want to make use of the history="discard" and history="invalidate" attributes on elements. I have placed those attributes where I want them, however, when I try to test whether or not they work by navigating to a view after the history attribute is run on the transition, it directs me to an exception page. org.springframework.web.util.NestedServletException: Request processing failed; nested exception is org.springframework.webflow.execution

How to include task parameter In array of tasks exception handling

吃可爱长大的小学妹 提交于 2019-12-06 04:38:59
The thread Nesting await in Parallel.ForEach has an answer suggested to use Task.WhenAll to run multiple (MaxDegreeOfParallelism) asynchronous tasks in parallel, not waiting until previous task is completed. public static Task ForEachAsync<T>( this IEnumerable<T> source, int dop, Func<T, Task> body) { return Task.WhenAll( from partition in Partitioner.Create(source).GetPartitions(dop) select Task.Run(async delegate { using (partition) while (partition.MoveNext()) await body(partition.Current).ContinueWith(t => { //observe exceptions }); })); } And call it like ids.ForEachAsync(10, async id =>

is __cxa_throw safe to ignore with Core Audio?

a 夏天 提交于 2019-12-06 04:38:55
问题 A similar question has been asked.. but I wanted to make it more specific to core audio.. as some of us may have noticed core audio has very little room for error. As the answer to the said question explains, __cxa_throw is a C++ unhandled exception, which can be ignored (this problem seems to be new with Xcode 4.5.1.. I've never seen it before as well) can we say the same about core audio? What makes me nervous is that it has to do with formatting of the audio.. which a lot of my code

Exception Handling/Mapping for a particular class

末鹿安然 提交于 2019-12-06 04:21:11
I have resource class which itself's talks with a internal service. This resource acts a rest API for the service. The service layer can throw unexpected exceptions, thus the resource should handle those handled unexpected exceptions and log it. I am using dropwizard framework which in turns use jersey. It goes like this. @PATH(/user) @GET public Response getUser(@QueryParam("id") String userId) { assertNotNull(userId); try { User user = service.getUser(userId); return Response.ok(user).build(); } catch (MyOwnException moe) { //basically 400's return Response.status(400).entity(moe.getMsg())

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