exception

Can I use the STL if I cannot afford the slow performance when exceptions are thrown?

For example, I'm writing a multi-threaded time-critical application that processes and streams audio in real-time. Interruptions in the audio are totally unacceptable. Does this mean I cannot use the STL because of the potential slow down when an exception is thrown? ...

C# Debugging problem when exception occurs

Hi! When I debug a C# program and I get an exception throwed (either thrown by code OR thrown by the framework), the IDE stops and get me to the corresponding line in my code. Everything is fine for now. I then press "F5" to continue. From this moment, it seams like I'm in an infinite loop. The IDE alway's get me back the the exceptio...

Does This ASP.NET Consultant Know What He's Doing?

The IT department of a subsidiary of ours had a consulting company write them an ASP.NET application. Now it's having intermittent problems with mixing up who the current user is and has been known to show Joe some of Bob's data by mistake. The consultants were brought back to troubleshoot and we were invited to listen in on their expl...

How can I capture all exceptions from a wxPython application?

I'm writing a little debug app for a bit of kit we're developing and I'd like to roll it out to a few users to see if they can provoke any crashes. Does anyone know a way of effectively wrapping a wxPython app to catch any and all unhandled exceptions that would cause the app to crash? Ideally I'd want to capture all output (not just er...

Is there a function to invoke a stack dump in C?

Can someone please provide an implementation of a C function that gets invoked to dump the current stack? It's for a x86 linux system. It can be invoked in 2 ways: explicitly by another function, or after a crash (probably as a trap/int handler). The output can be either to the screen or to a file, as indicated by a parameter (handle)....

How do you specify that an exception should be expected using Boost.Test?

I have a Boost unit test case which causes the object under test to throw an exception (that's the test, to cause an exception). How do I specify in the test to expect that particular exception. I can specify that the test should have a certain number of failures by using BOOST_AUTO_TEST_CASE_EXPECTED_FAILURES but that seems rather unsp...

Is there a way to prevent a SystemExit exception raised from sys.exit() from being caught?

The docs say that calling sys.exit() raises a SystemExit exception which can be caught in outer levels. I have a situation in which I want to definitively and unquestionably exit from inside a test case, however the unittest module catches SystemExit and prevents the exit. This is normally great, but the specific situation I am trying ...

Should exceptions be in a different project

When structuring a visual studio solution I tend to structure it so that various components are in different project (As I would assume most people do) I tend to have a bunch of User defined exceptions. The Question is should these exceptions be in a separate project to the (for example) Model classes? I tend to put them in a sub-names...

Exceptions for flow of control

There is an interesting post over here about this, in relation to cross-application flow of control. Well, recently, I've come across an interesting problem. Generating the nth value in a potentially (practically) endless recursive sequence. This particular algorithm WILL be in atleast 10-15 stack references deep at the point that it s...

Return 'null' or throw exception

I have a method that is suppose to return an object if it is found. If it is not found, should I: a) return null b) throw an exception c) other ...

bad_alloc error when using std::string

Hi all.. I'm currently working on a project that depends on me providing a path to a file (eg. "C:\Path.pth"). Now, I had everything working yesterday by calling my std::string with: std::string path("C:\\Path.pth"); -- But now it doesn't work!? It throws a bad_alloc. Seems like the '\' character is the problem. I even tried using \x5...

How do I find character positions in ANTLR 2?

I have a simple grammar, and have produced a pair of c# classes using antlr 2.7.7. When the parser finds an error with a token, it throws an exception; I want to find out how many characters into a parsed stream the token came. How do I do that? ...

InvalidProgramException in Team Foundation Server Sample

Hi I get an System.InvalidProgramException while trying to run the Example Project called "C# Example.WorkItemBrowser". The Exception also apears when I try to execute these lines: TeamFoundationServer tfserver = new TeamFoundationServer("http://localhost:8085"); tfserver.EnsureAuthenticated(); WorkItemStore store = new WorkItemStore(tf...

C# WebBrowser Control System.AccessViolationException

I have a program that uses the built in webbrowser control. At some point during the usage of this, I'm not sure at what point, but it appears to be random, I get the following error: System.AccessViolationException FullText = System.AccessViolationException: Attempted to read or write protected memory. This is often an indication tha...

Sanitizing Database Return Data

I am wondering what everyone thinks the best method of handling results from your own database is. Other teams may be involved and there is always the chance the procedure/data could be altered and erroneous results would occur. My question is this. Is it better to let and exception occur, catch and log it or try to handle all contingenc...

System.OutOfMemoryException using C# on a large data set

I'm using C# and I get an out System.OutOfMemoryException error after I read in 50,000 records, what is best practice for handling such large datasets? Will paging help? Thanks ...

Are exceptions really for exceptional errors?

It's my understanding that common wisdom says to only use exceptions for truly exceptional conditions (In fact, I've seen that statement here at SO several times). However, Krzysztof Cwalina says: One of the biggest misconceptions about exceptions is that they are for “exceptional conditions.” The reality is that they are for ...

Exceptions causing junk data in string (C#)

Ok, this is a weird one. The junk data isn't random either, it appears to be substrings of the executable itself. private void Form1_Load(object sender, EventArgs e) { string s = GetValue(); // at this point, s == "400". Why isn't really relevant (dumbed down a test) if (s != "18446744073709551615") throw new Except...

best practices for catching exceptions from sql in c#

What are some good ways to catch business logic exceptions or return values from SQL in c#? For instance upon creating a new user, if the user already exists, the system, and the user must be notified. I have used the raise_error() method with a particular state int value, I have used stored procedure return int values, and I have also s...

Odd exception thrown in .NET

Exception Thrown: "System.ComponentModel.ReflectPropertyDescriptor is not marked as Serializable" Does this mean I missed marking something as serializable myself, or is this something beyond my control? ...