exception

How to know the exact line of code where where an exception has been caused (C++)?

If I generate an exception by myself, I can include any info into the exception: a number of code line and name of source file. Something like this: throw std::exception("myFile.cpp:255"); But what's with unhandled exceptions or with exceptions that was generated not by me? Thanks. ...

asp.net "file not found" - no reference to file!!

Hi there - I'm working with asp.net (I'm a designer) and at some point during debugging it'll throw me and I'll get to an Exception objErr in the code - and when I hover it says "file not found". I assume it's an image but I've been searching and can't find anyway to pinpoint which file is missing. I hope this is enough information - if ...

How bad is ignoring Oracle DUP_VAL_ON_INDEX exception?

I have a table where I'm recording if a user has viewed an object at least once, hence: HasViewed ObjectID number (FK to Object table) UserId number (FK to Users table) Both fields are NOT NULL and together form the Primary Key. My question is, since I don't care how many times someone has viewed an object (after the f...

C# Extension Method Oddity during Unit Test

Using Visual Studio 2008 / C# / VS Unit Testing. I have a very straightforward extension method, that will tell me if an object is of a specific type: public static bool IsTypeOf<T, O>(this T item, O other) { if (!(item.GetType() is O)) return false; else return true; } It would be called like: Hashtable myHa...

Where can I find a list of SocketErrorCode and NativeErrorCode thrown by SocketException?

Hi, A SocketException has a SocketErrorCode and NativeErrorCode. I would like to find a list where these codes (or the common onces) are listed so I can respond in proper fasion. Does anybody know where to find such a list? ...

Why are .Net programmers so afraid of exceptions?

First of all, I'm not trying to be critical of anyone here or saying that all .Net programmers are this way. But I'm definitely noticing a trend: .Net programmers seem to avoid exceptions like they're the plague. Of course, there's always the Raymond Chen blog post about how hard exceptions can be to handle. But that doesn't just app...

How can I prevent Windows from catching my Perl exceptions?

I have this Perl software that is supposed to run 24/7. It keeps open a connection to an IMAP server, checks for new mail and then classifies new messages. Now I have a user that is hibernating his XP laptop every once in a while. When this happens, the connection to the server fails and an exception is triggered. The calling code usual...

Best way to return status flag and message from a method in Java

I have a deceptively simple scenario, and I want a simple solution, but it's not obvious which is "most correct" or "most Java". Let's say I have a small authenticate(Client client) method in some class. The authentication could fail for a number of reasons, and I want to return a simple boolean for control flow, but also return a Strin...

Call to Session.CreateSQLQuery ExecuteUpdate fails in NHibernate

I have a stored procedure that is used to synchronize data from another system through a linked server. I execute this call using NHibernate in a Windows Service that runs tasks using Quartz.net. One of these tasks is the synchronize data task and it is really just the sproc call: using(var tx = Session.BeginTransaction()) { Ses...

What does this mean in a stack trace?

I see this in a stack trace: myorg.vignettemodules.customregistration.NewsCategoryVAPDAO.getEmailContentByID(I)Lmyorg/pushemail/model/EmailContent; What does the "(I)L" mean? ...

Wrapping a web service in try/catch block

Hi, Is it best practice to wrap a web service method/call into a try/catch block? I dont' the web service request to be the reason why the .net desktop application crashes, so I was thinking all calls should be wrapped in try/catch to prevent this. Good idea? Also, should it throw an exception to or just have an empty catch? ...

When to dodge exceptions and when to handle them

What guidlines do you use when deciding whether to let a method dodge an exception (ie: let the exception propogate up) or handle it once the exception is recieved? Here is an example of what I am trying to ask If I have three methods method1,2,3 and 3. Method1 calls Method2 which Calls Method3. and the exception is only thrown in meth...

Best crash reporting framework for .NET desktop applications?

I've got a couple simple Windows Forms apps that I'd like to add crash reporting to. Something that will give me info on what crashes are happening on user's machines (wrt my app, of course), including stack traces, logs, and screenshots, and a UI component for asking the user whether they want to upload it, etc. My apps are free, so I'd...

How to Trace all local variables when an exception occurs

any generic way to trace/log values of all local variables when an exception occurs in a method? (in C# 3) ...

nHibernate Share References?

I'm getting a "Found shared references to a collection" exception when saving an object. Does anyone know what this means? ...

Why I get an Exception on opening an empty ZIP-file with java.util.zip.ZipFile?

I want to open a ZIP-file, that have no entries with java.util.zip.ZipFile. But on the constructor I get the following exception: 'java.util.zip.ZipException: error in opening zip file'. How can I open the empty ZIP? That ZIP-file is created by the commandline zip-program under linux. I simply deleted all entries from a ZIP-file. I nee...

Exception with System.Drawing.Image

hey guys, i'm getting an exception on the following inner exception: {"Value cannot be null.\r\nParameter name: String"} Which reads like a simple error message, but none of the values (image, fileName) are null. How can i find out where this null String is? RipHelper.UploadImage(image, fileName); which calls public static void Up...

Difference between catch block and throw new Exception in method

In a method, I want to be able to insert a value into a div which is part of the html document I choose to parse. public void AddToDiv(string div) { //Code to read the html document and look for the div //(name specified as the parameter of this method). } Question is, I could specify a div called "abc" but the html document ...

What is the best way to collect crash data?

So I am sold on the concept of attempting to collect data automatically from a program - i.e., popping up a dialog box that asks the user to send the report when something goes wrong. I'm working in MS Visual Studio C#. From an implementation point of view, does it make sense to put a try/catch loop in my main program.cs file, around w...

SqlDataReader throws NullReferenceException! what could cause this and how can I debug?

I found this in an error log and am trying to work out how it's possible. It's not every day that a NullReferenceException turns up deep within the .net base classes! 1) Exception Information ********************************************* Exception Type: System.NullReferenceException Message: Object reference not set to an instance of an...