exception

InvalidCastException while trying to deserialize JSON in C#

Hi everybody, I'm trying to deserialize a Json stream. I'm working under Visual Studion for Windows Phone 7. Here is the code I'm using: public Accueil() { InitializeComponent(); string baseUri = "http://path/to/my/webservice"; HttpWebRequest request = (HttpWebRequest)HttpWebRequest.Create(new Uri(baseUr...

inheriting from std::exception: undefined reference to vtable

Hello. I'd like to extend std::exception and override its what() method so that every time that in my code I throw and exception of type myException()m the message "my exception" will be printed. (trying to keep it minimal) I declare the class in a header and define my version of what() in a cpp class. The compiler complains: undefined...

WCF exceptions to JQuery

I have WCF service which communicates with SqlServer, and want to make frontend with JQuery. The question is: How can i catch WCF errors in JQuery code, such as failed connection or not existing database or some others. PS. Maybe its better to use something like ASP.NET MVC with JQuery rather than pure JQuery? ...

Help with Ruby Koans #6 - What exception has been caught?

I'm trying to learn Ruby through Koans but I'm stuck on the 6th step. Here's the code: def test_you_dont_get_null_pointer_errors_when_calling_methods_on_nil # What happens when you call a method that doesn't exist. # The following begin/rescue/end code block captures the exception and # make some assertions about it. ...

Catch Exception with Condition

This is a thought experiment, I'm interested in your opinion: Does it make sense to you? Do you know whether something similar has already been proposed for the C# programming language? I wouldn't even know where to send such a proposal... The idea is introducing syntax elements to catch an Exception only if it fulfills a certain condit...

upgrade to NHibernate 3.0.0.1002, Table is not mapped

Yesterday, I upgraded my NHibernate application from 1.2 to 3.0. I get the following exception c.SubContractors is not mapped [SELECT count(distinct c) FROM CallUp c, c.SubContractors sc Where sc.id = :id AND c.ChildCallUp IS NULL AND c.State > 0 AND (:start_date BETWEEN c.ContractStartDate AND c.ContractEndDate OR :end_date BETWEEN c.C...

InvalidOperationException exception in XNA

The following line will error sometimes in my .NET XNA program. VertexBuffer v = new VertexBuffer(GraphicsDevice, typeof(VertexPositionColorTexture), 4, BufferUsage.None); The exception that is thrown is InvalidOperationException, and it tells me that: "The current vertex declaration does not include all the elements required by the...

Visual Studio finish application on Exception

I have some places in the C# application where potential Exception's are not catched, but there is a try-finally block to release resources before crashing in case of an Exception. When I run the code in Visual Studio and an Exception occurs, it breaks at the corrsponding line, marks it yellow and describes the exception. That's fine. ...

Selecting Android Spinner Causes WindowManager$BadTokenException

I created a custom AlertDialog to display a Spinner and some EditText elements. When I select a menu option, this custom AlertDialog gets launched. Everything works fine until I actually select the spinner to try and select an item, at which point I get the BadTokenException. I've read other StackOverflow posts saying that similiar excep...

How to stop handled Exceptions from being logged?

I have just implemented exception handling for a unique-constraint of a JPA entity. It is working as I want it to, but when triggered dumps the handled exceptions to the container logfile. A JPA entity is managed by a SLSB (Service Façade). The Service Façade is called from another SLSB, which provides remoting capabilities based on JA...

Runtime Exception: "CoCreateInstanceEx: The specified service does not exist as an installed service."

I just checked the latest source out of our repository after the installer (NSIS if it really matters) was created and a bug was discovered. I started receiving the runtime exception CoCreateInstanceEx: The specified service does not exist as an installed service. on the following code: Opc.IDiscovery discovery = new OpcCom.ServerEnume...

How to suppress javascript exception?

In my application i am getting the content of some other domain's page. Along with the content it is running the javascript associated with the particular page. In the javascript code "document.selection.createRange()" is written which is throwing exception at run time in IE (since in IE due to security concern you can't change iframe's ...

Can dereferencing of pointer throw?

I'm teaching myself techniques of programming with exception safety mode of ;) and I wonder if dereferencing a pointer could ever throw an exception? I think it would be helpful for all C++ programmers to know all operations that are guarantied to not throw so I would be very grateful if someone could compose such list. ...

An exception that cannot be caught?

Hey, I have the following code in my files: In Class Customer.Page: Try If Not SiteContent.CurrentUser(False) Is Nothing Then If Not SiteContent.CurrentUser(False).IsAdministrator OrElse SiteVariables.CustomerMode Then SiteContent.PageViewManager.Create(New List(Of Control)) End If Else Site...

Java: why can't I throw an exception in Comparator?

The direct answer is because Comparator.compares interface is specified as such that it does not throw exceptions. But why is that? Or to put it different: My Comparator must depend on a function which can throw an exception. In theory, that should not happen. But if it happens, I want that it breaks out of the whole function where I am...

Java: would it make sense to have the throw-attribute generic?

When you pass a callback in some form to another function, you often have to fullfil some interface to be able to pass such callback. That callback interface will often restrict you in what type of exceptions you can throw. The most natural way for me would be that the called function would automatically rethrow (or ignore) the exceptio...

Using a try/catch to retry the same method

I have a class whose methods require that a certain class field exists correctly. That class field is set in the constructor and it's read from a config file, and it may or may not get the correct data from that config file. If the data is incorrect, it will have the wrong data in the class field and the class method will throw an except...

C++ re throw Exception gives error

I'm trying to catch a 'specific' exception (FormatException^ or OverflowException^) and then re throw it and catch it in the 'general' exception (Exception^) catch block. When run, I give it a format exception through input. I then get this error in a dialog box: "An unhandled exception of type 'System.FormatException' occurred in Futu...

Simple Java Exception Question

Hey, This is just a simple exercise from class that I decided to have a go at putting an exception in. According to the book input for this problem is supposed to be in the following format: APRIL 19, 2009 What I'm trying to do with my exception is make sure the user(whoever grades it) follows those parameters so my program works. Does t...

Wrap an IEnumerable and catch exceptions

I've got a bunch of classes that can Process() objects, and return their own objects: public override IEnumerable<T> Process(IEnumerable<T> incoming) { ... } I want to write a processor class that can wrap one of these processors, and log any uncaught exceptions that the wrapped Process() method might throw. My first idea was somethi...