exception

How to replace a character programatically in Oracle 8.x series

Due to repetitive errors with one of our Java applications: Engine engine_0: Error in application action. org.xml.sax.SAXParseException: An invalid XML character (Unicode: 0x13) was found in the element content of the document. I need to "fix" some Unicode character in an Oracle database, ideally in a programmatic fashion. Once identi...

What is the best implementation of an exception mechanism ?

Most program languages have some kind of exception handling; some languages have return codes, others have try/catch, or rescue/retry, etc., each with its own pecularities in readability, robustness, and practical effectiveness in a large group development effort. Which one is the best and why ? ...

Fail fast finally clause in Java

Is there a way to detect, from within the finally clause, that an exception is in the process of being thrown? ie: try { // code that may or may not throw an exception } finally { SomeCleanupFunctionThatThrows(); // if currently executing an exception, exit the program, // otherwise just let the exception thrown by the...

Unhandled Exception Logging for Winforms

Is there anything like elmah for Winforms? I'm looking for a standard way to process unhandled exceptions and grab a screenshot and other environment information before packaging that up for support. ...

Ruby exception inheritance with dynamically generated classes

I'm new to Ruby, so I'm having some trouble understanding this weird exception problem I'm having. I'm using the ruby-aaws gem to access Amazon ECS: http://www.caliban.org/ruby/ruby-aws/. This defines a class Amazon::AWS:Error: module Amazon module AWS # All dynamically generated exceptions occur within this namespace. # m...

How to gracefully deal with ViewState errors?

I'm running some c# .net pages with various gridviews. If I ever leave any of them alone in a web browser for an extended period of time (usually overnight), I get the following error when I click any element on the page. I'm not really sure where to start dealing with the problem. I don't mind resetting the page if it's viewstate has e...

How can I detect when an Exception's been thrown globally in Java?

How can I detect when an Exception has been thrown anywhere in my application? I'm try to auto-magically send myself an email whenever an exception is thrown anywhere in my Java Desktop Application. I figure this way I can be more proactive. I know I could just explicitly log and notify myself whenever an exception occurs, but I'd hav...

When to throw an exception

I have exceptions created for every condition that my application does not expect. UserNameNotValidException, PasswordNotCorrectException etc. However I was told I should not create exceptions for those conditions. In my UML those ARE exceptions to the main flow, so why should it not be an exception? Any guidance or best practices fo...

When is it right for a constructor to throw an exception?

When is it right for a constructor to throw an exception? (Or in the case of Objective C: when is it right for an init'er to return nil?) It seems to me that a constructor should fail -- and thus refuse to create an object -- if the object isn't complete. I.e., the constructor should have a contract with its caller to provide a function...

How to skip sys.exitfunc when unhandled exceptions occur

As you can see, even after the program should have died it speaks from the grave. Is there a way to "deregister" the exitfunction in case of exceptions? import atexit def helloworld(): print "Hello World!" atexit.register(helloworld) raise Exception("Good bye cruel world!") ...

WCF - Faults / Exceptions versus Messages

We're currently having a debate whether it's better to throw Faults over a WCF channel, versus passing a message indicating the status or the response from a service. Faults come with built in support from WCF where by you can utilize the built in error handlers and react accordingly. This however carries overhead as throwing exceptions...

Converting floating point exceptions into C++ exceptions

Is it possible to convert floating point exceptions (signals) into C++ exceptions on x86 Linux? This is for debugging purposes, so nonportability and imperfection is okay (e.g., if it isn't 100% guaranteed that all destructors are called). ...

C# How to check for valid xml in string input before calling .LoadXml()

I would much prefer to do this without catching an exception in .LoadXml() and using this results as part of my logic. Any ideas for a solution that doesn't involve manually parsing the xml myself? I think VB has a return value of false for this function instead of throwing an XmlException. Xml input is provided from the user. Thanks...

How does gcc implement stack unrolling for C++ exceptions on linux?

How does gcc implement stack unrolling for C++ exceptions on linux? In particular, how does it know which destructors to call when unrolling a frame (i.e., what kind of information is stored and where is it stored)? ...

How should exceptions be planned at the architectural level?

Are there any good resources for planning how exceptions will be used from an architecture perspective? (Or provide your suggestions directly here.) In projects on which I have worked I find that a few common Exceptions are used over and over again and tend to lose their meaning. From: http://jamesjava.blogspot.com/2007/10/exception-pl...

How to deal with "java.lang.OutOfMemoryError: PermGen space" error

Recently I ran into this error in my web application: java.lang.OutOfMemoryError: PermGen space It's a typical Hibernate/JPA + IceFaces/JSF application running on Tomcat 6 and JDK 1.6. Apparently this can occur after redeploying an application a few times. ...

How do I unit test an __init__() method of a python class with assertRaises()?

I have a class: class MyClass: def __init__(self, foo): if foo != 1: raise Error("foo is not equal to 1!") and a unit test that is supposed to make sure the incorrect arg passed to the constructor properly raises an error: def testInsufficientArgs(self): foo = 0 self.assertRaises((Error), myClass = MyClass(Error, ...

does elmah handle caught exceptions as well

I was wondering if something like elmah logged exceptions even when they do not bubble up to the application? I'd like to pop up a message when an exception occurs and still log the exception. Currently I've been putting everything in try catch blocks and spitting out messages, but this gets tedious. ...

Throwing exceptions in ASP.NET C#

Is there a difference between just saying throw; and throw ex; assuming ex is the exception you're catching? ...

Business Objects, Validation And Exceptions

I’ve been reading a few questions and answers regarding exceptions and their use. Seems to be a strong opinion that exceptions should be raised only for exception, unhandled cases. So that lead me to wondering how validation works with business objects. Lets say I have a business object with getters/setters for the properties on the obj...