This seems like it ought to be simple, but I've tried both
try {} catch (...) {} C++ exception handling and
__try {} __finally {} structured exception handling (SEH)
and neither one will catch the exception that happens when you Control-C the application.
I didn't really expect C++ exception handling to do this, since the Control-C ...
I seem to be encountering some funky behaviour when tracing is enabled in an ASP.NET MVC application:
Whenever tracing is enabled, the HandleError attribute fails.
I've reproduced this on the vanilla ASP.NET MVC app, and was wondering whether anyone has experienced anything similar.
Steps to Reproduce
Step 1
Create a new ASP.NET MVC...
Consider the following program. How is the behaviour that it displays (namely that exceptions will propagate out of an event handler) a "good thing"? As far as I can tell, it could only ever be bad; unexpected exceptions popping up from functions that they shouldn't. In my particular case, it was killing threads. So, is this behaviour ac...
After going through some links on exception handling (1, 2, and 3), I know that C++ programs can throw pretty much anything as exceptions (int, char*, string, exception class). I know that std::exception is the base class for standard exceptions thrown by the program. However, I'm trying to design a try...catch block as such:
try
{
...
I want to create a mecanism in a large .net application to handle all the exceptions in the application, and to save the error messages (in db or log file) so these errors can be fixed, and so we are aware of the problems in the application.
Does anyone know a good way of creating a library to handle and process all the exceptions?. Are...
In IE in the ff. code, the catch clause is entered if someMethodThatThrowsExceptions does throw an exception. However, this is not the case in Firefox. Is this a limitation in Firefox's Javascript engine or LiveConnect implementation? Does a workaround exist?
try {
document.applets["someApplet"].someMethodThatThrowsExceptions();
} ...
I see that the Finally in try .. Catch will execute allways after any parts of the execution of the try catch block.
Is it any different to just skip the Finally section and just run it after, outside the try catch block??
Example 1, Try ... Catch ... Finally ... End Try
Try
'Do something
Catch ex As Exception
...
Is it a good practice to use exception for managing cases that are not errors ?
Like in JavaScript and Python that manage the StopIteration case in generators (yield keyword).
...
What's your opinion in handling exceptions within a thread's execution? More specifically, what if the exception is thrown inside catch block of an try-catch clause? And what happen to the thread if the exception is unhandled?
...
I am developing a winforms application and I would like to know what are the best practices for exception handling. Whenever there is an exception occurring I open an exception dialog displaying the necessary information i.e. the message and stacktrace. Major confusion that I have is in cases where I want the user to see only a friendly ...
I am writing an app that I can feed tasks with multiple steps. I have some code similar to what's below and I want to know if this is the normal way to handle exceptions. This code will probably never be seen by anyone else, but it could be, so I'd like to know I'm handling the exceptions as anyone would expect.
IEnumerable<Task> Tasks;...
One thing that has bugged me with exception handling coming from Python to C# is that in C# there doesn't appear to be any way of specifying an else clause. For example, in Python I could write something like this (Note, this is just an example. I'm not asking what is the best way to read a file):
try
{
reader = new StreamReader(pat...
Hi
I have a VxWorks application running on ARM uC.
First let me summarize the application;
Application consists of a 3rd party stack and a gateway application.
We have implemented an operating system abstraction layer to support OS in-dependency.
The underlying stack has its own memory management&control facility which holds memory ...
I have a method that A) inserts a row in a table and then B) uses the resulting Identity value in several inserts in another table. If the logic in part B fails for any reason, I need to rollback all of the inserts for both parts B and A. I'm fairly certain that transactions would not work for this, although I'm open to being persuaded...
Hello,
I have a global HandledExceptionHandler. In the catch part of my try catch block I would like to pass the fully qualifed method name where the exception occurred. How do you do that? Can it be done without reflection. HEre is an example of what I am looking for...
Public Sub MySub
Try
'some error happens
Catch
...
I identified a bug in my code and I'm baffled as to how it could have occurred in the first place.
My question is, I found a skip in the database ID fields (it is an incremented identity field), indicating some records weren't inserted - which means my SQL sprocs (probably) threw an error. Thinking backwards from there, that means that ...
I have a winforms application.Winforms start with Program.cs where we have main() defined.I have put this code in try-catch block.
[STAThread]
static void Main()
{
try
{
Application.EnableVisualStyles();
Application.SetCompatibleTextRenderingDefault(false);
Application.Run(new...
Consider the following Python exception:
[...]
f.extractall()
File "C:\Python26\lib\zipfile.py", line 935, in extractall
self.extract(zipinfo, path, pwd)
File "C:\Python26\lib\zipfile.py", line 923, in extract
return self._extract_member(member, path, pwd)
File "C:\Python26\lib\zipfile.py", line 957, in _extract_memb...
Everyone here should know the 'or' statemens, usually glued to an die() command:
$foo = bar() or die('Error: bar function return false.');
The most of the times we see something like:
mysql_query('SELECT ...') or die('Error in during the query');
However, i cant understand how exactly that 'or' statement works.
I would like to thr...
I come from a C# background but I'm currently learning C atm. In C#, when one wants to signal that an error has occurred, you throw an exception. But what do you do in C ?
Say for example you have a stack with push and pop functions. What is the best way to signal that the stack is empty during a pop ? What do you return from that f...