exception

Is it possible to have the entity framework include the SQL command when it throws exceptions?

My problem is that when I get a SQL exception from the entity framework (say for example, because of a null value that isn't allowed to be null), it's sometimes hard to figure out which property is being referred to, and why it is null. Now I know I can set up a SQL trace and log it which will give me the information I need, but this me...

What's broken about exceptions in Perl?

A discussion in another thread got me wondering: what do other programming languages' exception systems have that Perl's lacks? Perl's built-in exceptions are a bit ad-hoc in that they were, like the Perl 5 object system, sort-of bolted on as an afterthought, and they overload other keywords (eval and die) which are not dedicated specif...

DataContractSerializer and List(Of Exception)

How can I serialize a list of Exception objects (also including derived exceptions, eg. FileNotFoundException) with the DataContractSerializer? I always get an error about the serializer not knowing the types in the list so i devised a workaround. It looked something like this: Dim XmlSerializer As New DataContractSerializer(Excep...

Clojure MySQL Syntax Error Exception ("[...] near '????????????????' [...]")

Hi there, I'm having trouble doing anything with clojure.contrib.sql beyond establishing a connection. I have a mysqld running on localhost:3306 with a database called clj_db. The user 'clj_user'@'localhost' with password 'clj_pass' can access this database. When trying to "select * from clj_table" I get a "com.mysql.jdbc.exceptions.M...

Local Tomcat Environment Not Starting

I'm attempting to get a local Tomcat environment running and am consistently encountering the following error: Can't load log handler "2localhost.org.apache.juli.FileHandler" java.lang.ClassNotFoundException: 2localhost.org.apache.juli.FileHandler java.lang.ClassNotFoundException: 2localhost.org.apache.juli.FileHandler at java.net.URLC...

Best way of replacing heavy exception use?

Hi, I have an old C++ project I made a while back. Well, it is a CPU emulator. Whenever a CPU fault happens(such as divide by zero, or debug breakpoint interrupt, etc) in my code it just does a throw and in my main loop I have something like this: try{ *(uint32_t*)&op_cache=ReadDword(cCS,eip); (this->*Opcodes[op_cache[0]])(); ...

unreported exception java.lang.ClassNotFoundException; must be caught or declared to be thrown

I have the following simple code: package test; import javax.swing.*; class KeyEventDemo { static void main(String[] args) { UIManager.setLookAndFeel("javax.swing.plaf.metal.MetalLookAndFeel"); } } It generates the following error message: KeyEventDemo.java:7: unreported exception java.lang.ClassNotFoundException; must...

Is returning null after exception is caught bad design

Hello, I always come across the same problem that when an exception is caught in a function that has a non-void return value I don't know what to return. The following code snippet illustrates my problem. public Object getObject(){ try{ ... return object; } catch(Exception e){ //I have to return something here but wha...

Use of Exceptions or Strings containing error codes in Software Services

We are creating an application for a client's website. The website will make a function call to our application to generate XML data, which we will return as a String. If something goes wrong during the course of our processing, how should we report this error? Should we throw an Exception for the client's website to catch, or should ...

How to add manifest permission to android application?

I am trying to access http link using HttpURLConnection to download a file, but getting this warning in LogCat WARN/System.err(223): java.net.SocketException: Permission denied (maybe missing INTERNET permission) I have added android.Manifest.permission to my application but its still giving the same exception Any suggestions? ...

NSInvalidUnarchiveOperationException: cannot decode object of class (UITableViewCellContentView)

Hey all, my App is failing on startup, i located the issue to the following code: - (UITableViewCell *)tableView:(UITableView *)tableView cellForRowAtIndexPath:(NSIndexPath *)indexPath { static NSString *MyIdentifier = @"MyIdentifier"; MyIdentifier = @"tblCellView"; TableCellView *cell = (TableCellView *)[tableView dequeueReusableCel...

PHP: Show user custom error, inside body

I am wanting to throw custom errors in many places in some interfaces that I am building. Just using an echo inside my function places that echoed code above the tag in my page. So, I built a custom function to handle errors and give me a backtrace, but again, it prints above the in my page. Here is the function I am using: functio...

How to disable exception assistant and unhandled exception popup in Visual Studio 2008 Express

Hi, I am using Visual Studio 2008 Express and am writing unit tests where there are many expected unhandled exceptions. This cause numerous exception assistant popups to display when running these tests in the debugger. I have disabled the exception assistant in the VS options, but a different unhandled exception dailog pops up instead. ...

.NET ex.Message vs ex.ToString?

I have code that is logging ex.Message. However I read an article that it's better to use ex.ToString(). This way you retain more crucial information about the error. Is this true, and is it safe to go ahead and replace all code logging ex.Message? I'm also using an XML based layout for log4net. Do you think the ex.ToString() will co...

pickerview app crashing due to NSRangeException NSCFArray objectAtIndex: index (5)...beyond bounds (5)

Once again working through beginning iphone development and I am putting together a bunch of UIPicker type apps, the last one of which is a slot machine type of game, super simple. Anyway I am not really understanding why this error is coming up. to my understanding the picker view is asking its delegate for an object in the array that ...

Is it OK to raise a built-in exception, but with a different message, in Python?

Is it OK to raise a built-in exception with a custom text? or to raise a built-in warning also with custom text? The documentation reads: exception ValueError: Raised when a built-in operation or function receives an argument (…) Is it implied that only built-in operations should raise a ValueError exception? In practice, I unde...

Python: Why can't I iterate over a list? Is my exception class borked?

I've already looked at this question: http://stackoverflow.com/questions/1152238/python-iterators-how-to-dynamically-assign-self-next-within-a-new-style-class but this doesn't help me because I want to iterate of an attribute of the error which is a list (ie, already iterable) without having to use the attribute explicitly. I'm looking ...

DivideByZeroException too slow

This is extremely slow: try { x = k / y; } catch (DivideByZeroException) { } This is about 5x faster: if (y > 0) x = k / y; Can anybody tell me why? ...

Response.Redirect results in "Object moved to here"

I'm working on a C# ASP.NET page that normally ends up redirecting to a "file:" URL. This seems to work fine the majority of the time, in the majority of circumstances, but occasionally (and, on my test system, apparently always) instead of a redirect to a file I get a page with the text "Object moved to here", where "here" is a link to ...

Performance cost of coding "exception driven development" in Java?

Are there are any performance cost by creating, throwing and catching exceptions in Java? I am planing to add 'exception driven development' into a larger project. I would like to design my own exceptions and include them into my methods, forcing developers to catch and do appropriate work. For example, if you have a method to get a us...