exception-handling

Can someone please explain exception handling to me?

I think this is a dumb question but I hear and see the term exception handling a lot. I have used try/catch, but i am still wondering what on earth 'handling' means. Can anyone kindly give some example that we can say the exception is actually 'handled'? sorry for poor English, hope i made myself clear. ...

JSFL error handling

When i started working on mogobe.com I wrote a small script that publishes all *.fla in all folder and sub folder. Now I want to add error handling for that script. I want to know is there is another way to get the data from those objects: fl.outputPanel fl.compilerErrors instead of writing them as file to the file system...

How to log an c++ exception

Hello! Do you know how can I log the exception ? right now the message in the catch statement is printed, but i cannot understood why ins´t Manage.Gere() called sussefully . try{ Manager.Gere(&par,&Acc, coman, comando, RunComando, log, &parti, comandosS, RunComandosSuper,true); } catch (...) { log("ERROR ENTER GERE*****"); } ...

Lifetime of a thrown object caught by reference

The C++ Standard, paragraph 15.1.4 sais: The memory for the temporary copy of the exception being thrown is allocated in an unspecified way, except as noted in 3.7.3.1. The temporary persists as long as there is a handler being executed for that exception. I'm wondering why this code crashes (I know that it's not best practice): c...

Who is calling the Java Thread interrupt() method if I'm not?

Hi all, I've read and re-read Java Concurrency in Practice, I've read several threads here on the subject, I've read the IBM article Dealing with InterruptedException and yet there's something I'm simply not grasping which I think can be breaked down in two questions: If I'm never ever interrupting other threads myself, what can trigg...

Implementing exception handling in ASP.NET 3.5

I would like to implement exception handling on a ASP.NET application. How do you suggest I implement it? Some requirements are: User should see a friendly page when an exception occurs Admin should get an email with exception details I understand there are several ways of implementing exceptions (ex: Log messages in the event viewer...

Log4Net Logging Exceptions

Hi guys I know I can log exceptions to the database using Log4Net, but I want to break up what it stores for an exception into different columns. Does anyone know if this is available, if anyone has done this or is it just easier to log exceptions to the database manually? Cheers Anthony UPDATE: If it helps maybe use the followin...

throw new exception vs writing message back to user (avoiding exception)

I see a lot of code written where an exception is thrown if a parameter is not in the right form, or whatever. Basically "throw new ...". What is the benefit of this? The exception can be avoided by checking the parameters (Eg if null, write message back to webpage/winform). Why is this approach not used when an exception is expensive? ...

How to handle exceptions thrown during the instantiation of a WPF Application?

I'm using the following code to display unhandled exceptions in a WPF application: public MyApplication() { this.DispatcherUnhandledException += (o, e) => { var exceptionMessage = new ExceptionWindow(); exceptionMessage.ExceptionMessage.Text = e.Exception.Message; exce...

How and where to handle exceptions in a 3-tier web application? Specifically Sql Database Exceptions

I'm building the standard 3-tier ASP.NET web application but I'm struggling as to where to do certain things - specifically handling exceptions. I've tried to have a look around on the web for some examples but can't find any which go as far as a whole project showing how everything links together. In my data-tier I'm connecting to SQL...

Custom Exception as Detail in Fault Exception

Hi, I'm trying to throw my own custom exception inside a FaultException from my WCF service and catch it in my WCF client. On the client side, however, the exception is caught as a non-generic FaultException and the details of my custom exception are lost. My custom exception is: [Serializable] public class MyCustomException : Applic...

Is it okay that I sometimes sink my exceptions?

I have a best practices question. I realize this is subjective but wanted to ask people smarter than me if this is a common programming practice. If you have a method of something NON-CRITICAL that you don't want to interfere with the important functioning of your application, is it common to use an error sink like this? Try 'do ...

Redirect on Error - ASP.NET

I understand that I can redirect a user on an exception by setting the customErrors element in the Web.config <customErrors mode="On" defaultRedirect="/WebTest/ErrorPages/AppError.html"> </customErrors> I could also do a Response.Redirect in the Application_Error event in the Global.asax file. What are the differences between these 2...

should one pass errors as exceptions to the UI code in a winforms applicaiton?

Hi, In a winforms application where the UI code calls business methods in my business classes, is it best practice to pass errors back to the UI code as an exception? Also if there are say a couple of main types of exceptions that a particular business method may have, where would it make sense to tailor the text that gets presented ...

Do php 5 try catches affect performance when no exception is caught?

Someone extremely smart at work told me try catches which don't throw will affect performance on a site with millions of users. based on the unit test posted showing equal performance, I'm wondering if this is related to an os level and/or web server specific situation. For instance, web server's implementation of asynchronous work occur...

Catching an Unhandled Exception Raised by an Unmanaged Sub-Process

Using C#'s System.Diagnostics.Process object, I start an unmanaged exe, that later starts yet another unmanaged exe. The 2nd exe is causing an unhandled-exception that I'd like my application to ignore, but can't seem to. I'm using a try/catch statement when I start the first process, but it doesn't seem to catch the exception raised b...

best approach for Logging/Error Handling framework for a C# .NET v3.5 application? (enterprise library / log4net / ?)

Hi, I'm working on a .NET v3.5 winforms app and would like to leverage some support for: a) logging (to file & to perhaps windows events) b) error handling / exception handling framework - to assist in distinguishing messages that can be shown to user versus handled within the code and logged c) a bonus extra would be how to capture/...

How to handle all errors, including internal C library errors, uniformly

I wanted to handle all internal errors gracefully, without program termination. As discussed here, using _set_se_translator catches divide-by-zero errors. But it does not catch, for example, C runtime library error -1073740777 (0xc0000417), which can be caused by format strings for printf which have the percent sign where they shoul...

C# question - how to populate a catch statement with the specific possible exceptions from the code in the try?

Hi, I'm using VS2008 and have ReSharper too. My question is how can I automate the creation of a try/catch block for which the catch is specifically populated with the possible exception from the try block? (i.e. not just put in an Exception ex) Background - Trying to help follow the best practice I read of "Don't catch (Exception...

Real time system exception handling

As always after some research I was unable to find anything of real value. My question is how does one go about handling exceptions in a real time system? As program failure generally is not the best case i.e. nuclear reactor/ heart monitor. Ok since everyone got lost on the second piece of this, which had NOTHING to do with the mai...