I have an application that is mixed Winforms and WPF. In Winforms, I have a global exception handler that is defined as follows:
AppDomain.CurrentDomain.UnhandledException += CurrentDomain_UnhandledException;
Application.ThreadException += Application_ThreadException;
This ALWAYS catches exceptions anywhere in my application that occu...
I would like to log unhandled exceptions from the global.asax to the Application eventlog. However, I've noticed that IIS is already logging these unhandled exceptions as warnings. Is there a way to suppress these messages since I'm planning on logging them myself or do you think it’s reasonable to have both entries there (the event lo...
I am developinga Core Data app for the iPhone, and I am new to the whole platform etc.
My question is, how much should I look for and handle errors and exceptions, for example when opening up the persistent store. Looking at the "Locations" Core Data Tutorial for example (hope its OK to quote it here like this):
(Se comments in the cod...
I have read it here : CodeProject
and some other places that there should be a single catch block per thread. I don't quite understand this in context of winforms. Is it true also in case of winforms? I understand that worker threads should have a single catch block. But, I have multiple catch blocks on the UI(main) thread which always ...
I inherited an application with a lot of stored procedures, and many of them have exception handling code that inserts a row in an error table and sends a DBMail. We have ELMAH on the ASP.NET side, so I'm wondering if exception management in the stored procs is necessary. But before I rip it out, I want to ensure that I'm not making a gr...
Hi, I've just seen a question on try-catch, which people (including Jon Skeet) say empty catch blocks are a really bad idea? Why this? Is there no situation where an empty catch is not a wrong design decision?
I mean, for instance, sometimes you want to get some additional info from somewhere (webservice, database) and you really don't ...
I have an exception that I need to swallow (exception during logging), however I dont want the exception information to be completely lost to the mists of time and so I figured I may as well at least output it to debug using
Debug.Write(ex.ToString());
That way if it becomes necessary support can at least use DebugView on the machine ...
As a C# developer I'm used to the following style of exception handling:
try
{
throw SomeException("hahahaha!");
}
catch (Exception ex)
{
Log(ex.ToString());
}
Output
------
SomeNamespace.SomeException: hahahaha!
at ConsoleApplication1.Main() in ConsoleApplication1\Program.cs:line 27
Its really simple, and yet tells me e...
I've created a web service and am using a Soap header for authentication, as described here:
http://aspalliance.com/805
I've adapted it, so that in every method, it calls a seperate "authenticate" method, which searches username and password in the db, and returns true or false.
My question is, within this method, if it returns false (i...
I have something like this:
class Vehicle
def self.set_color(input)
if %w{blue red green}.include?(input)
input
else
raise "Bad color"
end
end
end
class Car < Vehicle
def make_car
begin
my_color = Vehicle.set_color("orange")
rescue
puts "you screwed the pooch"
end...
I have the following code with the corresponding test case:
class XXX
attr_accessor :source
def check
begin
raise ArgumentError, "No source specified." \
unless @source.empty? != true
puts "Passed"
rescue
print "Error: ",$!, "\n"
end
end
end
class T...
I am trying to catch a runtime exception that will be thrown by a function that is basically just a wrapper function for oci_execute(). For example:
try {
$SQL = "INSERT";
ExecuteQuery($SQL);
} catch (Exception $e) {
echo "<p>There was an error.</p>";
echo $e->getMessage();
}
However, the exception doesn't appear to...
Hello. This question might sound a bit stupid but here it goes.
I have two functions that can be called at any moment. The first function takes a snapshot, and the second one analyses the data taken from that snapshot. Of course if the user tries to analyse the snapshot before taking it, my application should throw an exception. I know ...
Do you know any Open Source libraries for Delphi to serialize exceptions? I want to have a form “Exception has occurred”, so my users will be able to email error report to me. But apart from serializing exception manually, are there any open source libraries, that will serialize exception to XML or even flat file?
The absolute must-be: ...
I apologize as this question is somewhat basic; however, after a great deal of searching, I have not found a suitable answer. I am building a windows forms application and need to reference an app.config file for the location to a data file. Before calling
XElement xml = XElement.Load(ConfigurationManager.AppSettings["EntityData"].To...
Is the trickery way that we can show the entire stack trace (function+line) for an exception, much like in Java and C#, in C++?
Can we do something with macros to accomplish that for windows and linux-like platforms?
thanks
...
When would you use InvalidArgumentException versus OutOfRangeException for parameters to a method? Would you lean more towards OutOfRangeException for a parameter that is not correct (e.g. empty string)?
...
First, I am throwing run time exceptions for all unrecoverable exceptions, this causes these exceptions to travel up to the conainter, where I currently use an error page (defined in web.xml). In this error page is a scriptlet that invokes the logger.
The issue I am having with this is that the exception is no longer on the stack at thi...
I am trying to figure out the best practices when loggin exceptions.
So far, I am logging every time I catch an exception. But when a lower lever class catches an exception (say, from the database layer), and wraps it in our own application exception - should I also log the original exception there, or should I just let the upper lever ...
While searching SO for approaches to error handling related to business rule validation , all I encounter are examples of structured exception handling.
MSDN and many other reputable development resources are very clear that exceptions are not to be used to handle routine error cases. They are only to be used for exceptional circumstan...