My problem goes something like this:
HttpWebRequest request;
try {
request = (HttpWebRequest) WebRequest.Create(url);
} catch (UriFormatException) {
statusLabel.Text = "The address you entered was malformed, please correct it.";
statusLabel.ForeColor = Color.Red;
}
HttpWebResponse response = (HttpWebResponse) request.GetR...
Hi,
I am using the white automation API to test a silverlight app, but when an unhandled exception occurs in silverlight I don't know of a way to report this back to the unit test or check in the white api to see if there was an exception. Anyone got a way to do this?
...
Is it legitimate to have exception handling code in a class constructor, or should it be avoided? Should one avoid having exception-generating code in a constructor?
...
While writing some particularly complex exception handling code, someone asked, don't you need to make sure that your exception object isn't null? And I said, of course not, but then decided to try it. Apparently, you can throw null, but it is still turned into an exception somewhere.
Why is this allowed?
throw null;
In this snippe...
I've searched SO for an answer to this, but haven't found one.
When an object throws an exception at the end of the constructor, is the object valid or is this one of those 'depends on the construction technique'?
Example:
struct Fraction
{
int m_numerator;
int m_denominator;
Fraction (double value,
...
I have a function that loops while doing something that could throw an exception. Looks something like this:
public void myFunction() throws MyException {
while(stuff) {
try {
DoSomething() // throws an exception
}
catch (Exception ex) {
throw new MyException(some, stuff, of, mine, ex...
I have a class called "Website", and inside of that class I have the following property:
public HtmlForm RegisterForm
{
get
{
if (Forms.RegForm != null) / Forms is a custom object called HTMLForms that is a custom list collection
{
return Forms.RegForm;
}
else
{
// ...
I am writing a Java based service with WSDL for a .Net client to consume, and I thought that when I receive an invalid value from the client that I would throw an exception that my client could then catch and display in a message box or something to the user (the client is a desktop app).
I was wondering if it would be ok to use this ap...
I am using BeautifulSoup to parse XML:
xml = """<person>
<first_name>Matt</first_name>
</person>"""
soup = BeautifulStoneSoup(xml)
first_name = soup.find('first_name').string
last_name = soup.find('last_name').string
But I have a problem when there is no last_name, because it chokes. Sometimes the feed has it, and sometimes it doesn...
I've been looking around for some approaches to using ELMaH with ASP.Net MVC so that I can use the custom error page for all exceptions including 404s.
There is no shortage of questions asking how to get the /Shared/Error.aspx working correctly in ASP.Net MVC - either with or without ELMaH. I haven't had a problem with that task, but I...
Hello,
i've written a for loop in Objective-C, This is how my code looks like
NSString *string = [NSString stringWithContentsOfFile=@"/Users/Home/myFile.doc"];
NSString *seperator=@"\n";
NSArray *mainarray = [string componentsSeparatedByString:seperator];
// Since i want to parse each element of mainarray
for(NSString *s in mainarray)
{...
I develop custom DesignSurface base on Powerful DesignSurface (Extended)
and set UseSmartTags. it's work properly for standard .net control. but when i using some third-party component, (in case using 2 instance of one control),and click on first control and change some property using smartTag, and then click on second component smart ta...
My web application runs on multpile apache instances and I am having multiprocess logging issues because of this. I am currently using a SocketHandler for logging to a daemon using SocketServer that then writes logs to a single log file (similar to this example).
Now that I am using a SocketHandler for logging I am having trouble disco...
We have a system with a WCF layer.
The WCF services can throw various FaultExceptions, these are exceptions of type:
FaultException<MyStronglyTypedException>
All strongly types exceptions inherit from a base exception.
public class MyStronglyTypedException : MyBaseException
I can catch FaultException, but then I do not have acces...
Hello,
after my last project I had the problem that the client was expecting an object from the server, but while processing the clients input an exception that forces the server to close the socket for security reasons is caught.
This causes the client to terminate in a very unpleasant way, the way I decided to deal with this was send...
I am trying to start an error-reporting activty if unhandled exception detected. The problem is with exceptions thrown from main thread. Is there any way to start an activity if main thread crashed?
...
I'm working on a simple class to manage the lifetime of a HKEY.
class Key
{
HKEY hWin32;
public:
Key(HKEY root, const std::wstring& subKey, REGSAM samDesired);
Key(const Key& other);
~Key();
Key& operator=(const Key& other);
Key& swap(Key& other);
HKEY getRawHandle() { return hWin32; };
};
//Other Methods.....
I realize this may be subjective, so will ask a concrete question, but first, background:
I have always been an embedded software engineer, but usually at Layer 3 or 2 of the OSI stack. I am not really a hardware guy. I have generally always done telecoms products, usually hand/cell-phones, which generally means something like an ARM ...
Hi,
I am working in a code-base(C# 3.5), which is littered with exception handling blocks which return true/false, when inside in a function which returns 'bool'.
catch (Exception ex) { return false; }
This is not correct practice.I am thinking of logging the exception, and have a local variable(to function) which will be initialized...
As an example, assume the following snippet of VB.NET code to delete a directory.
Try
Dim SomeFolder="c:\somefolder"
System.IO.Directory.Delete(SomeFolder, True)
Catch ioex As System.IO.IOException
'What went wrong?
'File locked by another process?
'File not found?
'something else?
End Try...