exception-handling

Spring MVC 3: How to provide dynamic content to error page for HTTP 404 errors?

淺唱寂寞╮ 提交于 2019-12-22 08:31:22
问题 What I want: I want to provide a model to the HTTP 404 error page. Instead of writing a static error Page, which is specified within web.xml, I want to use an exception controller, which handles HTTP 404 errors. What I did: Removed error page tag from web.xml: <error-page> <error-code>404</error-code> <location>/httpError.jsp</location> </error-page> and implemented the following exception handler methods inside my AbstractController class: @ExceptionHandler

ASP.NET CustomErrors not firing when exceptions occur in global.asax or in web.config

不羁岁月 提交于 2019-12-22 07:56:23
问题 I have ASP.NET set up to use the CustomErrors functionality: <customErrors mode="On" defaultRedirect="~/ErrorPages/500.aspx" redirectMode="ResponseRewrite"> <error statusCode="404" redirect="~/ErrorPages/404.aspx" /> <error statusCode="500" redirect="~/ErrorPages/500.aspx" /> </customErrors> Everything works nice, and the relevant error pages are shown when appropriate. Except in the following two cases: 1) When there is an exception thrown in global.asax : public class MvcApplication :

Setting up 32feet library

ε祈祈猫儿з 提交于 2019-12-22 07:11:47
问题 I'm trying to get started with this library: 32feet I have a Broadcomm Bluetooth Stack and haven't been able to figure out how to get this library set up. When I run my code, I get: Unhandled Exception: System.PlatformNotSupportedException: No supported Bluetooth protocol stack found. After digging around on their site, I found this: Installation instructions It says to copy the appropriate DLL's into the project and then run the Test32FeetWidcommWin32.exe . I've tried putting the files in

Is Exception handling required in Spring Transaction?

和自甴很熟 提交于 2019-12-22 06:53:42
问题 I am having a doubt in exception handling with a Transaction. To state clearly my problem I would like to show my configuration: <bean id="transactionManager" class="org.springframework.orm.hibernate4.HibernateTransactionManager"> <property name="sessionFactory" ref="sessionFactory" /> </bean> <tx:annotation-driven transaction-manager="transactionManager" /> <bean id="transactionInterceptor" abstract="true" class="org.springframework.transaction.interceptor.TransactionProxyFactoryBean">

Handling 404 in WCF Rest Service

不羁岁月 提交于 2019-12-22 06:48:53
问题 I have a wcf rest service on IIS 7.5. When someone visits a part of the endpoint that doesn't exist (i.e. http://localhost/rest.svc/DOESNOTEXIST vs http://localhost/EXISTS) they are presented with a Generic WCF gray and blue error page with status code 404. However, I would like to return something like the following: <service-response> <error>The url requested does not exist</error> </service-response> I tried configuring the custom errors in IIS, but they only work if requesting a page

using exceptions for non-error purposes

偶尔善良 提交于 2019-12-22 06:44:19
问题 Is it a good practice to use exception for managing cases that are not errors ? Like in JavaScript and Python that manage the StopIteration case in generators (yield keyword). 回答1: It depends on the language. Each language has it's own design and idioms. For most languages exceptions should be exceptional. In languages like C++, Java and C# it is very bad form to use exceptions for anything else. In Python, exceptions are used more frequently for things like the end of an iteration. There is

Java reflection and checked exceptions

我的未来我决定 提交于 2019-12-22 06:43:49
问题 I have a method which I would like to call via reflection. The method does some various checks on its arguments and can throw NullPointer and IllegalArgument exceptions. Calling the method via Reflection also can throw IllegalArgument and NullPointer exceptions which need to be caught. Is there a way to determine whether the exception is caused by the reflection Invoke method, or by the method itself? 回答1: If the method itself threw an exception, then it would be wrapped in a

Handling Unknown Errors in protractor

痴心易碎 提交于 2019-12-22 06:39:30
问题 I have a protractor setup with multiple browsers configured through multiCapabilities , running tests on browserstack. One of my key protractor specs/tests contain the following afterEach() block: afterEach(function() { browser.manage().logs().get("browser").then(function (browserLog) { expect(browserLog.length).toEqual(0); }); }); that checks that the browser console is empty (no errors on the console). The problem is : when I run this spec against Internet Explorer, I'm getting an

How many function calls will cause stack overflow

两盒软妹~` 提交于 2019-12-22 06:39:17
问题 Hello android/Java developers, When a function call a function and that function call another one and so on, how many calls (stack length) would get me into stack over flow? Is there a general rule of thumb? The reason i am asking is because I am now which is more efficient(design wise) for my 5 players cards game Solution 1: for(int i=0;i<100;i++){ p1.play(); p2.play(); p3.play(); p4.play(); } Solution 2: p1.play(); //where p1.play() calls p2.play() and so on until p4 calls p1 again. // this

How many function calls will cause stack overflow

拜拜、爱过 提交于 2019-12-22 06:39:17
问题 Hello android/Java developers, When a function call a function and that function call another one and so on, how many calls (stack length) would get me into stack over flow? Is there a general rule of thumb? The reason i am asking is because I am now which is more efficient(design wise) for my 5 players cards game Solution 1: for(int i=0;i<100;i++){ p1.play(); p2.play(); p3.play(); p4.play(); } Solution 2: p1.play(); //where p1.play() calls p2.play() and so on until p4 calls p1 again. // this