exception

Exception handling differences questions

It is possible to catch an exception and throw a new exception which wraps the first exception as an inner exception: http://msdn.microsoft.com/en-us/library/system.exception.innerexception(VS.71).aspx Also, if I call a function and it throws a certain error, but I catch it, will the calling code's catch handler execute? If so, and it ...

object returned after an exception?

int somefunction(bool a) { try { if(a) throw Error("msg"); return 2; } catch (Error const & error) { //do i need to return anything here?? //return -1; } } ...

Best Practices for Python Exceptions?

What are the best practices for creating exceptions? I just saw this, and i don't know if i should be horrified, or like it. I read several times in books that exceptions should never ever hold a string, because strings themselves can throw exceptions. Any real truth to this? Basically from my understanding from the scripts is that this...

Server.Transfer and System.Threading.ThreadAbortException

See http://support.microsoft.com/kb/312629/EN-US/ I am using reponse.direct in my app as well and I am not getting the exception. The workaround that the knowledge base article suggests (Server.Execute) does not work for me. I am getting lots of javascript exceptions from the Ajax Toolkit on the target page if I use Server.Execute, and ...

How to debug ConcurrentModificationException?

I encountered ConcurrentModificationException and by looking at it I can't see the reason why it's happening; the area throwing the exception and all the places modifying the collection are surrounded by synchronized (this.locks.get(id)) { ... } // locks is a HashMap<String, Object>; I tried to catch the the pesky thread but all I ...

Guard Clause and Exception handling for the same condition

I ran across the following snippet of code. Names have been changed to protect the innocent: public void RunProgram() { System.IO.FileInfo fInfo = new System.IO.FileInfo(Application.StartupPath + "Program.exe"); if (!fInfo.Exists) { System.Windows.Forms.MessageBox.Show("Program could not be found, please verify your insta...

PHP: exceptions vs errors?

Maybe I'm missing it somewhere in the PHP manual, but what exactly is the difference between an error and an exception? The only difference that I can see is that errors and exceptions are handled differently. But what causes an exception and what causes an error? ...

Python - checking variable existing

Hello, i want to check whether variable exists. Now I'm doing something like this: try: myVar except NameError: # Doint smth Are there any other ways without exceptions? Or is that part of code right? ...

What is the most convenient way to stop an Ajax-object in prototype from swallowing exceptions?

Consider this code: new Ajax.Request('?service=example', { parameters : {tags : 'exceptions'}, onSuccess : this.dataReceived.bind(this) }); If an exception occurs anywhere in the dataReceived-function when it is called by the Ajax-object, it is swallowed by some exception handling code and the whole process then silently termi...

"Length of the data to decrypt is invalid." exception during Rijndael decryption

I get "Length of the data to decrypt is invalid." exception when i try to decrypt a memory stream. I am beginner, cant figure out whats wrong. whats wrong? public bool EncryptStream() { string password = @"myKey123"; // Your Key Here UnicodeEncoding UE = new UnicodeEncoding(); byte[] key = UE.GetBytes(passwo...

Java Bind Exception

What would cause a TCP socket to throw "java.net.BindException: Address already in use" even when reuse address is set to true? This only occurs if the application is quickly restarted. Running on CentOS 5 linux OS. ...

Difference Between Application Exception and System Exception.

I want to know the difference Between Application Exception and System Exception. Can anyone explain ...

how are exceptions compared in an except clause

In the following code segment: try: raise Bob() except Fred: print "blah" How is the comparison of Bob and Fred implemented? From playing around it seems to be calling isinstance underneath, is this correct? I'm asking because I am attempting to subvert the process, specifically I want to be able to construct a Bob such that...

Compact Framework Non Culture Specific Exception Messages

Hi Everyone, I have created an application in Compact Framework 2.0 This application is being used in many various counties and cultures. My Issue is that any and all exceptions are logged, but they are appearing in the culture of the device, in some cases this means i am unable to read them. Any help or suggestions will be appreciat...

Weird Exception with SQL Compact Edition

Hi all, I've deployed my application on a new machine, I've installed the Compact Edition Runtime and got a weird exception. I coudln't locate any info about that on the web furthermore, ways to solve it. Maybe you've encountered it? This is the exception: Type : System.Data.SqlServerCe.SqlCeException, System.Data.SqlServerCe, Vers...

Managing related but different Exceptions on Asynchronous Delegates

This is the scenario. I am using scsf to develop my application. I am using asynchronous delegates to keep my UI responsible. I have a CAB service which is in charge of notifying exceptions to the final users in a friendly manner (message box). I will show you an hypothetical example which ilustrates the actual issue (I will reduce the...

When and why is an std::__non_rtti_object exception generated?

I'm using Visual Studio and performing a valid dynamic cast. RTTI is enabled. Edit : Updated the code to be more realistic struct base { virtual base* Clone() { base* ptr = new base; CopyValuesTo( ptr ); return ptr; } virtual void CopyValuesTo( base* ptr ) { ... } virtual ~ba...

top-level exception handling with event handlers in c#

Hi, I am currently asking myself some questions about exception handling and eventhandlers, and i hope some of you will give me some help. I will start to explain what i would like to achieve in my c# application: I have a top-level method (lets call it the main method). This method calls an asynchronous method (wich is called connect...

What causing this "Invalid length for a Base-64 char array"

I have very little to go on here. I cant reproduce this locally, but when users get the error I get an auto email exception notification. Message: Invalid length for a Base-64 char array. Call Stack: at System.Convert.FromBase64String(String s) at System.Web.UI.ObjectStateFormatter.Deserialize(String inputString) at System.Web.UI.Obje...

Extend the exception thrown from ASP.NET when calling a Webservice from JQuery

I'm using JQuery to load controls dynamically in an ASP.NET development environment using JSON and WebServices. Within this solution I have a business logic layer which has a built in validation mechanism (i.e. validating properties and business rules similar to that of CSLA) When requesting a new control to be loaded dynamically using ...