exception-handling

How to get the Exception information from Marshal.GetExceptionCode();

When using Marshal.GetExceptionCode() how do you get the Exception Type and/or instance of the exception? http://msdn.microsoft.com/en-us/library/system.runtime.interopservices.marshal.getexceptioncode%28VS.71%29.aspx ...

controlling if exceptions are swallowed by a static boolean

So we are a few guys developing this product that is communicating with a really unstable server. It often returns very strange and corrupt data. During testing we want the resulting crashes to be loud, so we discover them. But every other day we need to demonstrate our product for a potential customer. To the customer the errors will go...

Hide an access violation on another application

Hi, I have an application that sometimes causes an access violation on exit. This is quite unpredictable and all attempts to locate the bug have been unsuccesful so far. The bug is harmless, as no data is lost, so I was thinking if it might be possible to just hide it. Is it possible to have another app launch the buggy one and catch t...

how to rethrow same exception in sql server

I want to rethrow same exception in sql server that has been occured in my try block. I am able to throw same message but i want to throw same error. BEGIN TRANSACTION BEGIN TRY INSERT INTO Tags.tblDomain (DomainName, SubDomainId, DomainCode, Description) VALUES(@DomainName, @SubDomainId, @Domai...

Java implementing Exception Handling

I am trying to implement an OutOfStockException for when the user attempts to buy more items than there are available. I'm not sure if my implementation is correct. Does this look OK to you? public class OutOfStockException extends Exception { public OutOfStockException(){ super(); } public OutOfStockException(St...

Exception wrapping and HTML pages

Hi, We have a sharepoint 2007 project at work. The exception handling policy is to log to the Sharepoint logs. In this case, would the best approach be to call that method and then rethrow the exception higher up? Except if I rethrow it to be caught higher up, there is no other exception handling code so what would happen in this case?...

how to solve unhandled exception error when using visual C++ 2008?

Hi, Could someone please help me to solve unhandled exception error when using visual C++ 2008? the error is displayed as follow: Unhandled exception at 0x00411690 in time.exe: 0xC0000005: Access violation reading location 0x00000008 Some details: - tm 0x00000000 {tm_sec=??? tm_min=??? tm_hour=??? ...} tm * tm_sec CXX0...

Implication of (not) rethrowing exception after logging

Hi, In a team environment, if I handle an exception (like so): protected void Page_Load(object sender, EventArgs e) { this.exTest(); } public void exTest() { try { throw new Exception("sjsj"); } catch (Exception ex) { string s = ex.Message; throw; } } What is the implicatio...

how to use localtime function with VIsual Studio C++ 2008

Hi I am getting this error : "Unhandled exception at 0x00411690 in tim.exe: 0xC0000005: Access violation reading location 0x00000008" when I execute a program this is compiled and linked successfully and the problem is that localtime() function is not correctly recognized by Visual C++ 2008. (With VC++6, this program works fine). ... ...

Wrong line number on stack trace

Hi! I have this code try { //AN EXCEPTION IS GENERATED HERE!!! } catch { SqlService.RollbackTransaction(); throw; } Code above is called in this code try { //HERE IS CALLED THE METHOD THAT CONTAINS THE CODE ABOVE } catch (Exception ex) { HandleException(ex); } The exception passed as parameter to the method "HandleE...

How to implement SEH (Structured Ecxeption Handling) in VB6?

Could someone provide some example on implementing SEH in VB6? Everything I've seen so far is in C++ ...

Does Application.OnException work in a COM Dll?

I want to log some seemingly random errors I'm getting in a Delphi written COM DLL. How do I do this? Is it possible to use the Application.OnException event handler? I have control of the COM DLL source, but not the calling application. ...

How do I use the information about exceptions a method throws in .NET in my code?

For many methods in .NET, the exceptions they can potentially throw can be as many as 7-8 (one or two methods in XmlDocument, Load() being one I think, can throw this many exceptions). Does this mean I have to write 8 catch blocks to catch all of these exceptions (it is best practise to catch an exception with a specific exception block...

What should I do if a IOException is thrown?

I have the following 3 lines of the code: ServerSocket listeningSocket = new ServerSocket(earPort); Socket serverSideSocket = listeningSocket.accept(); BufferedReader in = new BufferedReader(new InputStreamReader(serverSideSocket.getInputStream())); The compiler complains about all of these 3 lines and its complain is the same for all...

Exception while opening file

Hi I have a VC++ application and in my application i have some basic file operations. Below is the defaulting code CStdioFile cFile; CFileException e; CString sReport; CString sHtmlfile = "testreport.html" OutputDebugString((sHtmlfile)); if (!cFile.Open(sHtmlfile,CFile::modeCreate | CFile::modeWrite, &e )) { } The problem is my app...

finally in exception handling

What exactly does a finally block in exception handling perform? ...

Java Date exception handling try catch

Is there some sort of exception in Java to catch an invalid Date object? I'm trying to use it in the following method, but I don't know what type of exception to look for. Is it a ParseException. public boolean setDate(Date date) { this.date = date; return true; } ...

how to remove ConcurrentModificationException

what is this exception and how to remove this in my problem i am creating an arraylist of objects, and after checking some condition,i want to remove some objects. but the program is giving this exception ConcurrentModificationException. how to remove this thanks in advance ...

C# Pragma to suppress break on thrown error

First off I run my applications with exceptions thrown on any error (handled or not). Second I am using a TypeConverter to convert from a user input string to the actual object. Third TypeConverter offers no TryConvert method so I'm stuck using exceptions for validation, using this rather ugly bit of code here: try { this._newVal...

To Throw or Not to Throw

// // To Throw void PrintType(object obj) { if(obj == null) { throw new ArgumentNullException("obj") } Console.WriteLine(obj.GetType().Name); } // // Not to Throw void PrintType(object obj) { if(obj != null) { Console.WriteLine(obj.GetType().Name); } } What principle to keep? Personal...