Is it always a bad programming technique to leave a catch block empty when using a try-catch block?
In cases where I am expecting an exception, for example, I am reading 10 values from a file...and converting each value into a String. There is a possibility that one of the 10 values can be a null, but I don't want to stop my execution a...
Hi,
What would a piece of code which "uses exceptions to control flow" look like? I've tried to find a direct C# example, but cannot. Why is it bad?
Thanks
...
Hi all,
I'm having trouble catching exceptions when using the rackspace cloudfiles api com.mosso.cloudfiles.
I have the dll referenced and can perform actions against my cloudfiles account, but when I want to try to catch an exception such as ContainerAlreadyExistsException, I get the error The type or namespace cannot be found.
I've al...
Hello,
Is there any way to catch all the excepions within an application at Main() with a single try-catch irrespective of threads and appdomains within the application??
In other words I just want to use one try-catch to log all the errors in my application instead of using multiple try catches in various places.
Would appreciate any...
I am wondering if there is a way to differentiate between warning messages and error messages in Oracle? Does a Warning message count as an exception? Are warning just errors? Is there a clear difference? And if so, is there a way to catch warning messages explicitly, or information messages?
Thanks for any advice.
...
"I DONOT WANT TO use the default error page tachnique, because i donot want the webpage to redirect!"
yes there is the try and catch
yes there are way to add exception handling mathods overwrite for controls
but what i need is,
it may just be a simple sql command,it may be a control such as formview, it may be a control such as datag...
Hi all,
I am just starting out with unit testing and have a scenario I'm not sure how to appraoch and my solution doesn't feel right.
I have a bit of code that does something, if it fails i.e. throws an exception the exception is caught and logged as below.
public T CreateTypedObjectInstance<T>()
{
T o = default(T);
try
...
Possible Duplicate:
Unchecked exceptions in Java: Inherit from Error or RuntimeException?
Looking at how our applications do error handling, we have been steadily moving from a checked ExceptionHierarchy (e.g. Exception -> ApplicationException -> SomethingSpecificBadHappenedException) since in many cases we have many long call...
I'm working on a Web Hook in .NET 4.0 that will run a lambda asynchronously and then post the result to a given URI when it is finished.
I've got that to work, but now I want the Task to handle any exceptions that are thrown, and am finding it difficult to stop them from reaching the parent.
Here's part of my code:
private readonly Fu...
What's the correct way of ignoring ThreadAbortException when logging exceptions?
Is it safe to just catch it in an empty catch block to make it disappear?
...
I've been using C# for the last few years and I am currently bug fixing in C++.
In C# I could use lock on an object to make my code thread safe with:
lock(lockObject)
{
// Do some work
}
This would unlock the lockOject if there was an exception within the // Do some work
Is there something similar in C++? At the moment I can thin...
I came across a design that overrides [Scriptable.put][1] in a subclass of ScriptableObject to do some conversion. If the conversion fails the code is throwing an exception. Which means that property assignments like following code can cause a runtime exception to be thrown
aScriptable.dateOfArrival = aVar;
By default rhino would...
I have custom exceptions in my django project that look like this:
class CustomFooError(Exception):
def __init__(self, msg="Something went wrong with Foo."):
self.msg = msg
def __str__(self):
return repr(self.msg)
At various points in my code I will raise exceptions like this:
raise CustomFooError("Things a...
Sort of a continuation from an earlier question, done a bunch of googling, but I don't think I'm on the right path here. Essentially what I'm doing is opening a file with a segment of code like so:
byte[] cipherText = File.ReadAllBytes(encryptedFile);
Then passing that byte array to a static bool method which calls the actual decrypti...
Is it possible to restore the normal execution flow of a C program, after the Segmentation Fault error?
struct A {
int x;
};
A* a = 0;
a->x = 123; // this is where segmentation violation occurs
// after handling the error I want to get back here:
printf("normal execution");
// the rest of my source code....
I want a mechanism s...
Hello,
I have read that I can create an implementation of javax.ws.rs.ext.ExceptionMapper that will map a thrown application exception to a Response object.
I've created a simple example which throws an exception if the phone length is greater than 20 characters when persisting the object. I am expecting the exception to be mapped to...
try {
if (isFileDownloaded)
//do stuff
else
throw new CustomException()
}
catch (Exception e)
{
// something went wrong save error to log
}
finally
{
//release resources
}
My question is would the catch catches the ApplicationException thrown in the try bl...
Using PHP 5.3.2 I'm handling an Exception in a catch block. After logging the error, I want to pass it on for the Framework to handle. When I try to rethrow the exception, throw $e, the current catch block is reexecuted causing a duplicate entry in my log and then the exception is passed on up.
...
I'm not asking about how to use the begin..rescue statement in Ruby. Rather, I'm asking how do you figure out what's worth worrying about. I know some hardcore people probably go through the documentation/code to find every single possible error, and have code that handles all cases gracefully. But that might be going too far if you're n...
I have a windows service, in which I want a top level try-catch that catches any otherwise unhandled (or bubbled) exception, logs it to the Event Log and then swallows it so the service keeps running. However, I can't find any overload to System.Diagnostics.EventLog.WriteEntry that takes an exception as a parameter - is there no way to j...