I'm working with an application which uses wcf and sharp architecture, I'm trying to create a service to write to the database. Here is my service:
[ServiceContract]
public interface IFacilitiesWcfService : ICloseableAndAbortable
{
[OperationContract]
void AddFacility(string facility);
}
[AspNetCompatibilityRequirements(Requir...
I am using Visual Studio 2003 to compile and run following program.
There are 4 assignment operation where I expect 2 of them to run ok and 2 of them to raise exception. There is a dynamic casting inside overloaded = operator which expect to fail during non proper cross casting (Casting from Apple to Orange or Orange to Apple). But in m...
I am currently refactoring an application which uses exceptions for logic flow. The code is difficult to read and maintain and makes a S.O.L.I.D fanboy like myself cry when reading it (not to mention the longest catch block I've ever seen in my career).
My question is what pattern(s) could you use to make it easier to maintain or how w...
Hey
I have run into a rather weird little problem.
In the following code I can not understand how e can be null;
try
{
//Some Code here
}
catch (Exception e)
{
//Here e is null
}
As far as I know, throw null will be converted to throw new NullReferenceException().
The problem seems to be related to multithreading, as removi...
Is there a best-practice or industry standard for throwing exceptions from a toolkit API?
Should the user facing methods catch and wrap up Exception in some sort of CustomException so that users only have to worry about CustomExceptions coming out of the API?
Or is the convention to just let those bubble up?
We're concerned with being...
I have a nasty exception that seems to occure deep inside the DataGridView Code.
I have a class that inherits from BindingList which is the DataSource of a BindingSource which is the DataSoure of a DataGridView.
Under some strange circumstances I get an exception during the overridden OnListChanged() method of my class:
protected ...
Hi, I'm developing an application that reads data from a SQL server database (migrated from a legacy DB) with nHibernate and s#arp architecture through ADO.NET Data services. I'm trying to map a many-to-many relationship. I have a Error class:
public class Error
{
public virtual int ERROR_ID { get; set; }
public virtual string E...
I am the developer of a WCF service. My test clients work very well with it. But when it comes to real clients (using the same client proxy), it fails. The same WCF service works with netTcpBinding, this error occurs only with netNamedPipeBinding, even with ConcurrencyMode = ConcurrencyMode.Single
Here is the exception
There was no ...
I have a tough question to ask so please bier with me.
In this code below, this works because the programmer was interested in projecting only the specific errors caused by the physical data-layer to the eventlog. The rest are pushed farther up the stack. This is specifically because he is able to catch OdbcException(s).
I am impleme...
I'm having a discussion about which way to go in a new C++ project. I favor exceptions over return codes (for exceptional cases only) for the following reasons -
Constructors can't give a return code
Decouples the failure path (which should be very rare) from the logical code which is cleaner
Faster in the non-exceptional case (no che...
I've successfully compiled this code, but when I get around to the last for loop in the main, I get a core dump handle_exception. How do I fix this?
main.cpp
#include <iostream>
#include <string>
#include <fstream>
#include <vector>
#include "DRSequence.h"
using namespace std;
vector <DRSequence> array;
int indexOfSequenceWithFirstWo...
It seems to me Google's alternatives to exceptions are
GO: multi-value return "return val, err;"
GO, C++: nil checks (early return)
GO, C++: "handle the damn error" (my term)
C++: assert(expression)
Is multi-value return useful enough to act as an alternative? Why are "asserts" considered alternatives? Does Google think it O.K. if a...
When I compile and run my application on my local machine with specs Windows XP sp2, JDK 5u11, I get no error. But when I try to run this application (compiled on Windows XP) on a Linux Debian distro, JDK 5 I get the following error:
Unable to instantiate class load helper class: null
What can I do to get rid of this exception message...
I want to use boost::asio but I don't want boost to throw exceptions, because in my environment exceptions must not be raised.
I've encountered BOOST_NO_EXCEPTIONS but the documentation says that callers of throw_exception can assume that this function never returns.
But how can a user supplied function not return? What replacement fun...
I am designing an exception hierarchy in C++ for my library. The "hierarchy" is 4 classes derived from std::runtime_error. I would like to avoid the slicing problem for the exception classes so made the copy constructors protected. But apparently gcc requires to call the copy constructor when throwing instances of them, so complains abou...
Consider these two snippets:
try:
a+a=a
except SyntaxError:
print "first exception caught"
.
try:
eval("a+a=a")
except SyntaxError:
print "second exception caught"
In the second case the "second exception .." statement is printed (exception caught), while in the first one isn't.
Is first exception (lets call it "S...
I have a ListView that displays error to the user. Part of it also includes the exception message. The error is also written to a log file.
Now I have noticed that some exception messages end with a newline. e.g. File.Move can return the message (English .Net 3.5 SP1) "Cannot create a file when that file already exists.\r\n".
The newli...
I heard people say exception handling is a bit expensive because of the stack unwinding.
I don't get something, the stack unwinding happens whether I throw an exception and whether I use "return". So where is the difference?
If for example I get a memory problem that I can't handle - the only option is to stop the function till the I r...
I am setting up PHP on my Tomcatserver using the PECL-servlet (PHP/PECL-version 5.2.5). The server now sucessfully handles real PHP-files, but i am having a problem with requests for nonexistent pages.
A request for such a page, f.ex: http://www.mydomain.com/nonexistentfile.php, causes the servlet to raise a java.io.IOException, which i...