exception-handling

Exception Handling in MVP Passive View

Hello, I'm wondering what's the preferred way to manage exceptions in an MVP implemented with a Passive View. There's a discussion in my company about putting try/catch blocks in the presenter or only in the view. In my opinion the logical top level caller is the presenter (even if the actual one is the view). Moreover I can test the...

In Asp.net i'm not able to catch any exception properly?

In Asp.net (c#),i'm not able to catch exception(FileNotFoundException) properly... i don't know the reason..Actually File s not there..But catch statement fails to catch the exception.. here is the code.. try { System.Drawing.Image imgg1 = System.Drawing.Image.FromFile(Server.MapPath("").ToString() + "\\images\\img1.jpg"); } catch (File...

Strange exception phenomenon in Windows 7

I spot some interesting articles about exception handle in CodeProject http://www.codeproject.com/KB/cpp/seexception.aspx After reading, I decided to do some experiment. The first time I try to execute the following code char *p; p[0] = 0; The program died without question. But After several times when I executed the same proble...

What happens if my IExceptionPublisher throws an Exception?

Hi, I'm using the .NET Exception Management Application Block (EMAB). As part of this I am implementing IExceptionPublisher classes. However, I am wondering what happens if these publishers encounter an Exception. I had a bit of a look around and apparently they are meant to do something like this: try { /* Normal Exception Pub...

How do you access the Source Error, Source File and Line Number of an exception to use in a custom error page?

Basically I want to take the following: And make it match the styling of the rest of the application. I am creating a custom error page in my C# based project and I want it to be able to show the same information that is displayed in the ASP.NET default error page. From fiddling with reflector I can see that this is generated through ...

Automatic bookkeeping for exception retries

Do any languages that support retry constructs in exception handling track and expose the number of times their catch/rescue (and/or try/begin) blocks have been executed in a particular run? I find myself counting (and limiting) the number of times a code block is re-executed after an exception often enough that this would be a handy la...

How to catch exception when loading .NET WinForm app user.config file?

Sometimes in .NET (2.0) WinForm desktop apps which use the default configuration system, the user.config file will become corrupted and can't be loaded anymore (when the configuration system tries to load it, it'll throw a System.Xml.XmlException). Putting aside the question of "why did the file get corrupted in the first place" (maybe ...

How to stop the running wcf services in silverlight when exception happens

After some digging into exception handling in silverlight and reading some useful blogs like this Silverlight exception handling using WCF RIA Services and WCF Services I ended up implementing similar idea in the App.xaml.cs to show an error page and call another wcf service method to log the error to the event viewer: private void A...

Difference between IllegalAccessError and IllegalAccessException

Consider this pair of Throwable: IllegalAccessExceptionextends Exception Thrown when an application tries to reflectively create an instance (other than an array), set or get a field, or invoke a method, but the currently executing method does not have access to the definition of the specified class, field, method or constructor...

How to capture unhandled exception in C# .NETMF 4.0?

Anyone know how register an event handler for unhandled exceptions in C# .NETMF 4.0? A Google search reveals nothing. Thanks! ...

Why .NET exceptions are mutable?

I'm wondering why .NET exceptions classes from Base Class Library has some mutable members by default Why I can change the Source, HelpLink and values from Data, but can't change anything else like the Message? Why throwing the exception rewrites the StackTrace making it mutable too? Is appending the stack trace information to existing...

How should I handle a possible memory leak because of an exception in Objective-C?

I have a method which allocates an object and then releases it at the end. In between, the method calls another method which could possibly raise an exception, and the exception will probably be caught by the method calling my method. If this happens, the object will never get released (or will it?). How should I prevent this from happen...

exception handling

Is there any section in c++ for which we can not handle exceptions? ...

Javascipt exception handling

Hi, Is there any way I could catch any uncaught exception in javascript? I mean, all my "dangerous" code are in try-catch blocks. But what about exceptions that I don't handle explicitly? I'm using jQuery, my main javascript file starts with : $(document).ready(function(){}) here I bind some events to some DOM elements. I can use t...

java exception trace

When i execute the below code,I am seeing the output as: Finally Exception in thread "main" java.lang.NullPointerException at ClientTestConcepts.main(ClientTestConcepts.java:9) Who prints the bold faced statements. public class ClientTestConcepts { public static void main(String []args){ try{ ...

Catch most derived exceptions?

Hi, In .NET, when catching exceptions, should I always catch derived exceptions (so not ArgumentException but the derived types)? Also: If I am asked to use error codes, would this be in the constructor like so?: throw new Exception("4000", ex); Or a custom exception type with an errorcode property? (This may get confusing with exce...

Guidance: how to handle exception handling involving tons of observers for an activty stream pattern?

I'm implementing an ActivityStream for my site based on the answer provided in this question: http://stackoverflow.com/questions/202198/whats-the-best-manner-of-implementing-a-social-activity-stream. My approach is to use observers after_create to create the activity record, including the metadata. I have a ton of observers, and don't ...

Windows Azure: Argument Exception was unhandled

I want my Azure application to create a blob and write a data into it. When I tried it I got this exception stating that ArgumentException was unhandled Stream was not writable here is my code var ms = new MemoryStream(); for (int k = 0; k < 10; k++) { using (StreamWriter sw = new Stre...

Android exception handling, program halts....

I'm trying to catch a login exception thrown by the class that readerAccount belongs to in the code below. while(!readerAccount.isAuthenticated()) { try { readerAccount.login(); } catch(AuthenticationException e) { cmDialog.show(); Toast.makeText(this.mCtx, "login failed", Toast.LENGTH_SHORT).show(); ...

iPhone Production/Release Exception Handling

In advance, please excuse my lack of understanding for iPhone/Objective-C Best Practices; I come from a .NET/C# background. Although, I've read many posts regarding exception handling for the iPhone, I'm still not exactly clear on what most people do for production code. Also, I haven't been able to find any open source apps with error ...