I have been using CPPUnit as a unit testing framework and am now trying to use it in an automated build and package system. However a problem holding me back is that if a crash occurs during the running of the unit tests, e.g. a null pointer dereferencing, it halts the remainder of the automation.
Is there any way for CPPUnit to recove...
What does it mean:
"First-chance exception at in : 0x000006BA: The RPC server is unavailable"
?
this debug message appears in Debug output of visual studio debugger when I using socket connection, but I don't know what operation initiates this message...
...
I regularly want to check if an object has a member or not. An example is the creation of a singleton in a function. For that purpose, you can use hasattr like this:
class Foo(object):
@classmethod
def singleton(self):
if not hasattr(self, 'instance'):
self.instance = Foo()
return self.instance
But ...
Wow, I just got back a huge project in C# from outsourced developers and while going through my code review my analysis tool revealed bunches of what it considered bad stuff. One of the more discouraging messages was:
Exceptions.DontSwallowErrorsCatchingNonspecificExceptionsRule : 2106 defects
The developers assure me they had good ...
What is the best technique for catching ALL exceptions thrown within JavaScript?
Obviously, the best technique is to use try...catch. But with ansynchronous callbacks and so forth, that can get tricky.
I know IE and Gecko browsers support window.onerror, but what about Opera and Safari?
Here are a bunch of test-cases that I would lik...
Are the following code snippets essentially equivalent?
catch(Exception E) {
...
throw E; //Explicitly rethrow the exception
}
and
catch(Exception E) {
...
throw; //Implicitly rethrow the exception
}
Duplicate of this question.
...
There is this style of exception system where a component throws component-specific exception. For example, all data access classes throw DataAccessException.
In this style, I often find myself having to catch and rethrow the component specific exception, because called methods are delcared as throws Exception:
try {
int foo = foo(...
We are logging any exceptions that happen in our system by writing the Exception.Message to a file. However, they are written in the culture of the client. And Turkish errors don't mean a lot to me.
So how can we log any error messages in English without changing the users culture?
...
I have created a Python module that creates and populates several SQLite tables. Now, I want to use it in a program but I don't really know how to call it properly. All the tutorials I've found are essentially "inline", i.e. they walk through using SQLite in a linear fashion rather than how to actually use it in production.
What I'm try...
I am using Apache HttpClient and would like to communicate HTTP errors (400 Bad Request, 404 Not Found, 500 Server Error, etc.) via the Java exception mechanism to the calling code. Is there an exception in the Java standard library or in a widely used library that would be appropriate to use or to subclass for this purpose?
The alterna...
I'm working on a large, aging code base for an MFC app. The code has been worked on by many developers over time, and as a result, we have three different ways throughout the code of dealing with the possibility of an allocation failure with new.
The first way is to test for NULL on the result of new. We don't use nothrownew.obj so th...
I was getting bad data from an application I was writting using C++ in Visual Studio 2k3 so I decided to debug it. Then I found it was throwing an exception but one I can't track down.
Then I placed some try/catch blocks and low and behold, when I don't debug there is no exception. That is, I have code that looks like this:
std::vecto...
While debugging through a .NET 3.5 SP1 project which is contacting a local web service, I'm receiving the exception
System.BadImageFormatException: "Bad Class Token"
Of course there aren't much more details about what's causing the exception.
I can tell that the method where this occurs, which is in the same class as it's caller, the ...
Hi,
I have two windows services running on the same machine. Both the services uses
private HttpListener listener;
I specify the baseURL as "http://IPAddress:8080/" & "http://IPAddress:8081/" respectively for each of the services. Then I do the needful and call
listener.Start();
The first service starts successfully at 8080 port. Bu...
If I need to throw an exception from within my application which of the built-in .net exception classes can I use? Are they all fair-game? When should I derive my own?
...
I'm wondering what the best way is to have a "if all else fails catch it".
I mean, you're handling as much exceptions as possible in your application,
but still there are bound to be bugs, so I need to have something that
catches all unhandled exceptions so I can collect information and store
them in a database or submit them to a web s...
Should you always check parameters and throw exceptions in .NET when the parameters are not what you expected? E.g. null objects or empty strings?
I started doing this, but then thought that this will bloat my code a lot if it’s done on every single method. Should I check parameters for both private and public methods?
I end up throwin...
I'm writing a stored procedure that needs to have a lot of conditioning in it. With the general knowledge from C#.NET coding that exceptions can hurt performance, I've always avoided using them in PL/SQL as well. My conditioning in this stored proc mostly revolves around whether or not a record exists, which I could do one of two ways:...
I expected A::~A() to be called in this program, but it isn't:
#include <iostream>
struct A {
~A() { std::cout << "~A()" << std::endl; }
};
void f() {
A a;
throw "spam";
}
int main() { f(); }
However, if I change last line to
int main() try { f(); } catch (...) { throw; }
then A::~A() is called.
I am compiling with "Micr...
I'm trying to implement an IErrorHandler in my WCF service in order to log every exception that hits the service boundary before it's passed to the client. I already use IErrorHandlers for translating Exceptions to typed FaultExceptions, which has been very useful. According to the MSDN for IErrorHandler.HandleError(), it's also intend...