exception-handling

How to sniff a caught exception in .NET on production machine?

Is there a way to find what exception was caught by .NET code from the outside of the application? I found that 3d party API throws an exception and suppresses it (I see the perf counter going up). But it doesnt shows it in trace (I tried sysinternals dbgView). What tool can show a caught exception? ...

Where to catch exceptions

I have a WCF svc separated into a Service Layer, Business Logic Layer and Data Access Layer. When my DAL encounters an exception, should I catch it there or let it bubble back up to the Service Layer? And why? Please disregard any client involvement for this scenario, I am only concerned with logging the exceptions on the WCF svc. ...

Exception not throwing (in Win7?)

Hi I have application reads in data from text file. Recently I realized that I should make a data checker for the data in the text file, to see if I can display/handle it correctly. Basically at the moment all the checker does is see if data is in the correct format, i.e. double is a double, int is int, etc... And if it isn't I'm thro...

Why exceptions are not propagated by WPF Dispatcher.Invoke?

Here's my hypothetical example. I have a very simple WPF window with a one Button. The Button.Click event has a handler that goes like this. Action doit = () => { Action error = () => { throw new InvalidOperationException("test"); }; try { this.Dispatcher.Invoke(error, DispatcherPriority.Normal); } catch (Exception ...

The python exception vs C++ exception handling

With the following code, I get the "Gotcha!" with python. try: x = 0 y = 3/x except Exception: # ZeroDivisionError print "Gotcha!" I think this is the equivalent C++ code, but it can't catch the exeption. #include <iostream> int main() { int x = 0; //float y = 3.0/x; int z = 0; try { z = 3 / x; } ca...

How can I know the name of the exception in C++?

With Python, I could get the name of the exception easily as follows. run the code, i.e. x = 3/0 to get the exception from python "ZeroDivisionError: integer division or modulo by zero" tells me this is ZeroDivisionError Modify the code i.e. try: x=3/0 except ZeroDivisionError: DO something Is there any similar way to find the except...

Error processing : return value vs exception in C++

In the course of asking about catching 'divide by 0' exception, I found that with C++, we can't do that. I mean, divide by 0 doesn't throw an std::exception. Some of the hints that I found were I have to check the value, and throw the exception by self. I say it's confusing, as I've thought that C++ adopted the exception idea in order...

How can I programmatically launch visual studio and send it to a specific file / line?

I have a nice tidy way of capturing unhandled exceptions which I display to my users and (optionally) get emailed to myself. They generally look something like this: Uncaught exception encountered in MyApp (Version 1.1.0)! Exception: Object reference not set to an instance of an object. Exception type: System.NullReferenceExcepti...

in a try-block, how to do sth. if no exception occurs ? obj-c

in a standard try-catch-error-block, how can i advice the programm to do something only, if no error is thrown ? for example, if i want to configure a proxy for something ip-based, and if it all works, it should grey-out the button. ...

PHP __toString does not work with trigger_error as advertised

It is known that __toString cannot throw an exception but I have read ( Link 1, Link 2 ) that it supports trigger_error so I tried the following code: public function __toString() { try { return $this->render(); } catch (Exception $e){ trigger_error($e->getMessage()); return ''; ...

Struts 2 - How to map a wildcard-matched method to an exception?

Hello, I'm working with Struts2. Here's a snippet of my struts.xml file: <action name="*test" class="fend.config.TestAction" method="{1}"> <exception-mapping result="fail" exception="java.lang.UnsupportedOperationException"/> <result name="success">/registerCrisis.jsp</result> <result name="dummy">/d...

Stop an operation without stopping the module in python

Well, I have made a module that allows you to copy a file to a directory easier. Now, I also have some "try's" and "except's" in there to make sure it doesn't fail in the big messy way and doesn't close the terminal, but I also want it to display different error messages when a wrong string or variable is put in, and end the module, but ...

Rails Exception Handling

Hi, How can I send the error messages that are happening in the model code back to the view. I mean. I have a begin Some code rescue Exception Handling end now error occurs and in the rescue, I would like to send a message back to the controller, so that it ll get displayed in the view. Do I have to use a variable, whic...

Rails Validation Error

Hi... While trying to add an error message using add_to_base, I am getting an undefined method 'errors' message. I am defining it in my model. Am I supposed to include any other file in order to access the errors variable. Model File - I am defining it inside a method self.errors.add_to_base("Invalid Name") Error Message undefined ...

Exception Safety in Qt

Wikipedia says that "A piece of code is said to be exception-safe, if run-time failures within the code will not produce ill effects, such as memory leaks, garbled stored data, or invalid output. Exception-safe code must satisfy invariants placed on the code even if exceptions occur." And it seems that we need exception handling for ex...

Expected Declaration Specifiers "NSRangeException"

I had this in my try-catch-finally and it compiles ok. @catch (NSException *e) { ..... } ...but when I tried to catch NSRangeException: I got error. @catch (NSRangeException *ne) { ..... } The error is: Expected declaration specifiers: NSRangeExpection (TechZen says -- this presumably a typo for:) Expected declaration specifi...

Error handling in pl/sql

Hi, I'm Dinesh from Bhiwani, and I want to know about error handling in PL/SQL. Can anyone help me to find brief description on this topic? ...

How to define Custom Exception in Web Application(Struts2, Hibernate,Spring)?

Hi, This is a very general question, I hope you won't laugh or scold me.Anyway here it comes: I am using struts2, hibernate, jpa and spring.I have four layers in my application: 1.Struts Action Layer, 2.Business Layer, 3.Service Layer, 4.Common Utility Layer So I need to define a Custom Exceptions so that if exception happens at server...

ExceptionMapper issue in RESTEasy

So in my JAXRS application, I have 2 ExceptionMapper registered as @Provider public class MyExceptionMapper implements ExceptionMapper<Exception> {...} public class MyCustomRuntimeExceptionMapper implements ExceptionMapper<MyCustomRuntimeException> {...} When my application throws a new "MyCustomRuntimeException", the exception is ca...

Exception caught when project debugged from IDE but not when run outside of IDE.

In C#, WinForms, VS2008, .NET 3.5... For this code: static class Program { /// <summary> /// The main entry point for the application. /// </summary> [STAThread] static void Main() { try { Application.EnableVisualStyles(); Application.SetCompatibleTextRenderingDefault(fal...