I want the user to simply be able to exit my application. However, for some reason, code which I have on a time delay, controlled by a stopwatch, is still trying to execute. I do not care if it tries to do so or not, but I want to stop the error and force-quit the application, terminating ALL running threads where they stand.
I am using...
Hi folks,
consider the following situation:
There is an ASP.NET MVC application which utilizes ELMAH for centralized ExceptionLogging. A Controller is marked with the HandlerError Attribute to catch a specific type of an exception and presents the user with a view. For example
[HandleError(ExceptionType = typeof(ModelSpecificException...
Hi.
An MFC, C++ application I'm working on seems to be throwing an exception deep inside a device driver. (It's an access violation writing to a NULL pointer from the looks of things. The details of the crash are not what is interesting me right now, however...)
I can get the Visual Studio Debugger to break when the exception occurs ...
What's better practice in a user-defined function in Python: raise an exception or return None? For example, I have a function that finds the most recent file in a folder.
def latestpdf(folder):
# list the files and sort them
try:
latest = files[-1]
except IndexError:
# Folder is empty.
return None ...
Mentally, I've always wondered how try/throw/catch looks behind the scenes, when the C++ compiles translates it to assembler. But since I never use it, I never got around to checking it out (some people would say lazy).
Is the normal stack used for keeping track of try's, or is a separate per-thread stack kept for this purpose alone? Is...
We use Microsoft's Enterprise Library (4.1) and frequently have the following problem:
[ArgumentException: Log entry string is too long. A string written to the event log cannot exceed 32766 characters.]
System.Diagnostics.EventLog.InternalWriteEvent(UInt32 eventID, UInt16 category, EventLogEntryType type, String[] strings, Byte[] ra...
What is a good design for a set of exception classes? I see all sorts of stuff around about what exception classes should and shouldn't do, but not a simple design which is easy to use and extend that does those things.
The exception classes shouldn't throw exceptions, since this could lead straight to the termination of the process wi...
I have often come across situations like :-
try{
...
stmts
...
}
catch(Exception ex) {
...
stmts
...
} finally {
connection.close // throws an exception
}
which still needs a try - catch block inside finally.
What is the best practice to overcome this?
...
I've been doing object-oriented programming for most of the past 7 years, using Java on and off during that time. Some things I'm certain I have an excellent grasp of, such as the most useful design patterns. In fact, the following code allowed me to crank out a little system in under a day's time, that would handle the one particular ...
I am looking for a better means of error trapping my sql connections on connection.open, so that I may log the error better and determine where in my application it is faulting.
I am using try catch and logging the exception caught but what I really want is to know which connection is failing. My application is iterating through 70 se...
I have some test cases. The test cases rely on data which takes time to compute. To speed up testing, I've cached the data so that it doesn't have to be recomputed.
I now have foo(), which looks at the cached data. I can't tell ahead of time what it will look at, as that depends a lot on the test case.
If a test case fails cause it doe...
Let's say there are three consecutive function calls in one try block and all of them throw the same type of exception. How can i figure out which function call threw the caught exception when handling it?
...
Is it possible to have a DataServiceException pass along a list of errors to consumers?
Rather than just receive the standard Message, Stacktrace information I would also like to have a list of errors when various validations fail on a model.
I tried to set the DataServiceException's inner exception to FaultException.
[DataContract]
p...
I have this sort of format
asp.net MVC View -> Service Layer -> Repository.
So the view calls the service layer which has business/validation logic in it which in turns calls the Repository.
Now my service layer method usually has a bool return type so that I can return true if the database query has gone through good. Or if it failed...
If there's an exception in a Rails application, one gets an error page with the call stack, request parameters and a code excerpt.
Is it possible to create a different output if the request is an XHR request?
Is it possible to re-define the exception output in general? (I assume that would automatically answer the first question)
...
Which of the following exception notification solutions is the best?
Exceptional
Hoptoad
exception_notification
exception_logger
...
I'm developing a C# utility class that runs an external command on a Linux server via SSH (I'm using SharpSSH; I like it so far and I recommend it) and gives back some meaningful information based on the command's output.
Somewhere in the aforementioned output is an integer that should never be outside some range, but I'd like to preven...
Is it possible to check weather custom errors is turned on or off in the code on web application runtime.
...
I want to install a SIGSEGV and friends handler in C++ to print a stack trace and exit on a crash.
backtrace_symbols_fd from glibc is almost what I want, but it doesn't symbolize calls in anonymous namespaces. However, gdb deals with that just fine (I have symbols compiled in, DWARF etc).
What library would you recommend for my situati...
Is there a C# equivalent of Java's Thread.setDefaultUncaughtExceptionHandler()?
...