exception-handling

Handle PortletException in JSR-168

Hi, How can I catch and handle the PortletException thrown by GenericPortlet.doView()? I'd like to show a custom error page or custom message in JBoss portal if this exception is thrown for some reason. ...

How to catch Exception Message in Erlang?

This is the Exception message thrown by Gen_server when its not started. ([email protected])32> R11 = system_warning:self_test("SysWarn"). ** exception exit: {noproc, {gen_server,call, [system_warning_sup, {start_child, {system_warning_SysWarn, ...

How to Catch Particular DB error in ASP.NET

In my SP (Sql Server 2005) I'm raising an error using Raiserror ('No Records Fetched' , 16 ,1) I want to catch this particular error in ASP.NET.. how do I do it ? ...

Is it possible to have the entity framework include the SQL command when it throws exceptions?

My problem is that when I get a SQL exception from the entity framework (say for example, because of a null value that isn't allowed to be null), it's sometimes hard to figure out which property is being referred to, and why it is null. Now I know I can set up a SQL trace and log it which will give me the information I need, but this me...

OpenGL suppresses exceptions in MFC dialog-based application

Hello. I have an MFC-driven dialog-based application created with MSVS2005. Here is my problem step by step. I have button on my dialog and corresponding click-handler with code like this: int* i = 0; *i = 3; I'm running debug version of program and when I click on the button, Visual Studio catches focus and alerts "Access violation ...

VS2010 Beta 2 Won't Continue Past Exception

I'm debugging a WinForms client that calls a WCF service in VS2010 Beta 2. I want to test my exception handling code, so I intentionally mis-configured my endpoint in app.config. The expected ConfigurationErrorsException is thrown. However, VS2010 stops on the offending line of code even though I have set it not to break for either Th...

What's broken about exceptions in Perl?

A discussion in another thread got me wondering: what do other programming languages' exception systems have that Perl's lacks? Perl's built-in exceptions are a bit ad-hoc in that they were, like the Perl 5 object system, sort-of bolted on as an afterthought, and they overload other keywords (eval and die) which are not dedicated specif...

Avoiding specific PHP Fatal error: Uncaught exception to allow script to continue running

Hi all, I would like to make it so that my scripts can continue to run even if there's a CERTAIN fatal error. Right now I can get this fatal error: PHP Fatal error: Uncaught exception 'MongoConnectionException' with message blah blah. How do we catch this specific error, log it, but allow the script to continue to run? Anyone has idea...

how can I get Visual Studio to not go into Debug for my specific BusinessLogicException?

Hi, I would like Visual Studio not to enter the Debug mode when it picks up a specific exception I define (i.e. BusinessException is this case). This is because I have a specific global error handler that will then present this to the user. Is there a way to avoid the VS debug pickup for this exception (so I'll go straight to seeing...

Exception Handling in a Java Web Application

I am developing a medium size Java Web Application with Struts as MVC framework and simple JDBC at Data Access Layer. I have been searching for exception handling best practices in such an application. I have found several articles, some of them being contradictory, only making me more confused rather than making things clear and simple....

Exceptions are swallowed in my WPF application. How to force application to crash?

I am new to WPF, I am using VS2010 beta2, .NET 4.0. Throw new Exception("test") in my code simply swallows exception and application does not crash. This is not what I expect, I want the application to crash if unhandled exception occurs. Is there a simple way to achieve this? Also, neither Application.DispatcherUnhandledException no...

PHP: Show user custom error, inside body

I am wanting to throw custom errors in many places in some interfaces that I am building. Just using an echo inside my function places that echoed code above the tag in my page. So, I built a custom function to handle errors and give me a backtrace, but again, it prints above the in my page. Here is the function I am using: functio...

.NET ex.Message vs ex.ToString?

I have code that is logging ex.Message. However I read an article that it's better to use ex.ToString(). This way you retain more crucial information about the error. Is this true, and is it safe to go ahead and replace all code logging ex.Message? I'm also using an XML based layout for log4net. Do you think the ex.ToString() will co...

Python: Why can't I iterate over a list? Is my exception class borked?

I've already looked at this question: http://stackoverflow.com/questions/1152238/python-iterators-how-to-dynamically-assign-self-next-within-a-new-style-class but this doesn't help me because I want to iterate of an attribute of the error which is a list (ie, already iterable) without having to use the attribute explicitly. I'm looking ...

Zend Framework: catch custom soap exceptions

how do I catch my custom soap fault ProductoInexistente when requesting a soap web service operation? my code is the following, but it's not working: $_WSDL_URI = 'http://joaquinlrobles.redirectme.net:8080/Pelopincho/PelopinchoService?WSDL'; $ws = new Zend_Soap_Client($_WSDL_URI, array('soap_version' => SOAP_1_1)); try { $resultado = $...

using catch(...) (ellipsis) for post-mortem analysis

Someone in a different question suggested using catch(...) to capture all otherwise unhandled - unexpected/unforseen exceptions by surrounding the whole main() with the try{}catch(...){} block. It sounds like an interesting idea that could save a lot of time debugging the program and leave at least a hint of what happened. The essence ...

Spring DefaultMessageListenerContainer, ActiveMQ and message redelivery

Hi, if I use the DefaultMessageListenerContainer of Spring to recieve JMS messages, I don't get JMS messages redelivered, even if I set sessionAcknowledgeMode to 2. In case of a RuntimeException within the onMessage() of my JavaBean, the message is not acknowledged within the JMS provider (ActiveMQ), it stays as pending in the queue. B...

Exception reporting frameworks for Cocoa

Hi, Are there any frameworks that capture and report exceptions? I need something that catches any exceptions or errors caused by my program while its being used by a non-technical user and then to email it to me. Do you handle this on your own projects? Did you roll your own solution or is there an off the shelf solution? Any help wou...

Multiple Try-Excepts followed by an Else in python

Is there some way to have several consecutive Try-Except clauses that trigger a single Else only if all of them are successful? As an example: try: private.anodization_voltage_meter = Voltmeter(voltage_meter_address.value) #assign voltmeter location except(visa.VisaIOError): #channel time out private.logger.warning('Volt Meter...

Begin, Rescue and Ensure in Ruby

Hi, I've recently started programming in Ruby, and I am looking at exception handling. I was wondering if ensure was like finally in c#. So if I have the following: file = File.open("myFile.txt", "w") begin file << "#{content} \n" rescue #handle the error here ensure file.close unless file.nil? end or should I do this? #store the ...