exception

EXC_BAD_ACCESS after modifying string

I am manipulating a large string by removing chunks of characters, and assigning the new string back to the original string. articleString = [articleString stringByReplacingCharactersInRange:startRange withString:@""]; articleString is an instance variable of type NSMutableString This seems to work fine the first time I go through t...

Proper way to handle InnerException trees?

I'm working with some classes which, when throwing, have a relatively deep InnerException tree. I'd like to log and act upon the innermost exception which is the one having the real reason for the problem. I'm currently using something similar to public static Exception getInnermostException(Exception e) { while (e.InnerException !...

C# Is there an Exception overview?

I was wondering if there's a list with all Exception types. I know a few Exceptions, but I don't know them all. Sometimes I throw an Exception and then I think, maybe .NET already has an Exception for this. For example, now I need an Exception that says that a process doesn't exists (like a file). So therefore my question is: Does anyb...

How many statements in a try/catch statement?

Should I put multiple statements in a try and then catch all possible exceptions, or should I put only one statement in the try statement? Example: try { MaybeThrowIOException(); MaybeThrowFooBarException(); return true; } catch (IOException e) { // ... } catch (FooBarException e) { // ... } Or try { MaybeThr...

ExceptionAsserts & debugging your C# project in VS

We've been using NUnit & VisualStudio to write C# .NET code for a while now. Testing Exceptions was done in the style of old syntax: [Test] [ExpectException(typeof(ExceptionType))] public void TestExceptionType() { } Now NUnit has released version 2.5.2 which introduced Assert.Throws( Type expectedExceptionType, TestDelegate code...

Capturing Ctrl-c in ruby

I was passed a long running legacy ruby program, which has numerous occurances of begin #dosomething rescue Exception => e #halt the exception's progress end throughout it. Without tracking down every single possible exception these each could be handling (at least not immediately), I'd still like to be able to shut it down at ...

LINQ InvalidCastException error

Hi, I'm getting "InvalidCastException" (occurred in System.Data.Linq.dll) in my function: public User GetUserByKey(Guid key) { return usersTable.FirstOrDefault(m => m.UserKey == key); } which is called here: MembershipUser mu = Membership.CreateUser(user.UserName, user.Password, user.Email, null, null, true, Guid.NewGuid...

Catching exceptions by value, reference or pointer

Possible Duplicate: catch exception by pointer in C++ What is the best way to catch an exception: by value, reference or pointer and why? ...

Unhandled exception: 0x80000001: Not implemented. (VC++)

Hi all, I am using MS Visual Studio 2005 (C++).. Could anyone tell me what could cause a runtime exception like so..? Unhandled exception at 0x07ed0027 (xxx.dll) in yyy.exe: 0x80000001: Not implemented. xxx.dll is a dll i am working on and yyy.exe is an exe that is calling that dll.. When the undhandled exception comes up while d...

Java unreported exception

While learning Java I stumble upon this error quite often. It goes like this: Unreported exception java.io.FileNotFound exception; must be caught or declared to be thrown. java.io.FileNotFound is just an example, I've seen many different ones. In this particular case, code causing the error is: OutputStream out = new BufferedOutpu...

Android preferences exception

When I execute the following code: Preferences.userRoot().nodeExists(strNodeName); I get an exception : java.util.prefs.BackingStoreException: Cannot get children names for User Preference Node: /! Any idea ? ...

Django - reversing wrapped view functions

I am trying to incorporate django-schedule into my project. Django-schedule's source is here. I don't like the urls, because they all capture a slug. My project will only allow one calendar per user, so it doesn't make sense to capture the slug. So, I wrapped the django-schedule views like this (look up the slug using the current user, a...

Sending message result in an exception

I'm trying to send a message by using Javamail API, with tomcat as a webserver, but the following code resulted me in a big exception whenever I try to send the message without a file an an attachment. Although it works with messages as an attachment. public static String send(String to,String body,Stringsubject,String file,String from)...

Moving Current execution position in an ASP.NET project

I'm not sure why but in my asp.net project in this code block when i get an exception on GetRequestStream() i cannot move my cursor to another point in the function as i normally do when i get a function. The reason is Unable to set the next statement to this location. The next statement cannot be set to another function. Is there some...

How to get a value through a out/ref parameter from a method which throws an exception?

this code outputs "out value". class P { public static void Main() { string arg = null; try { Method(out arg); } catch { } Console.WriteLine(arg); } public static void Method(out string arg) { arg = "out value"; throw new Exception(); } } but this one doesn't. class P { publ...

Will C++ exceptions safely propagate through C code?

I have a C++ application that calls SQLite's (SQLite is in C) sqlite3_exec() which in turn can call my callback function implemented in C++. SQLite is compiled into a static library. If an exception escapes my callback will it propagate safely through the C code of SQLite to the C++ code calling sqlite3_exec()? ...

PageMethods exception details

I have quite a big project and it is all done using pagemethods. Code behind is basically just to serve and handle the data. Everything works perfect, except for one thing - I recently created a custom exception class that I want to use for more user friendly reports and even possible actions. For this purpose, I inherited the exception ...

Invalid parameter number on PDO Prepared Statement

Hello, I'm working with a sequence of queries created with PDO class, in some case, my queries needs the same paramter. I've created an array used in a foreach statemend which save the data but some var is ouside, can I use both data in one query? the example: // $connection is the PDO object; // $full_data contains: // $full_data[$i][...

How to report all exceptions in JVM, be it own or third-party code?

Is there a way to log all exceptions happening within JVM? A system is built from a big number of smaller components provided by different groups. All of them are running within the same JVM (under Weblogic). Error reporting policies are rather different in those groups, so sometimes we have cases of suppressed exceptions, which makes...

C#: An item with the same key has already been added, when compiling expression

Ok, here's a tricky one. Hopefully there is an expression guru here who can spot what I am doing wrong here, cause I am just not getting it. I am building up expressions that I use to filter queries. To ease that process I have a couple of Expression<Func<T, bool>> extension methods that makes my code cleaner and so far they have been w...