exception

Is it a good or bad idea throwing Exceptions when validating data?

Hi, When validating data, I've gotten into a habit of doing the following *Note: i dont really have individual booleans for each check. This is just for the example. *Another Note: any error handling during the tests are done properly. The ONLY exceptions thrown in the try-catch are my own. Try { if(validCheckOne = false) { thro...

Compact Framework - Invalid URI: Hostname could not be parsed.

I'm writing a compact framework 3.5 application for a windows mobile device. In this application I'm consuming a web service in order to sync with our database. However, whenever I try to make a call to the web service from the device or the emulator, I get the following error: Invalid URI: Hostname could not be parsed. I'm connected ...

wpf custom control xaml null error

Yet another strange WPF error: I have a custom control in a simple XAML page. The project builds and runs perfectly, with no errors. Here's the XAML: <Window x:Class="Grapher2.Window1" xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation" xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml" xmlns:graph="clr-namespace:Gr...

selenium: delete all visible cookies raises an exception

I am using selenium with a python client. When doing selenium.delete_all_visible_cookies I get the exception: ERROR: Command execution failure. Please search the forum at http://clearspace.openqa.org for error details from the log window. The error message is: malformed URI sequence The log window's error is: error(125...

Python: is it bad form to raise exceptions within __init__?

Is it considered bad form to raise exceptions within __init_? If so, then what is the accepted method of throwing an error when certain class variables are initialized as None or of an incorrect type? ...

rmi class can not found exception

I wrote an simple project using java rmi and exported to an executable jar file. When I tries to run it, sometimes i got exceptions and sometimes it works. When I specify -Djava.rmi.server.codebase=file:serverClasses/, it seems it didn't create the jar file correctly. Here is the stacktrace: java.rmi.ServerException: RemoteException oc...

How to log my traceback error?

I've been trying to get this working, but for some reason it's giving me errors... How can I log my python errors? try: pass #CODE HERE except: pass #LOG TRACEBACK ERROR ...whatever that error may be ...

How would you intercept all Exceptions?

What is according to you the simplest way to intercept all exceptions in a Java application? Would AOP be needed to provide this kind of functionality or can it be done with dynamic proxies or is there another way? Is the simplest solution also a good solution regarding impact on execution performance? I would like to hear possible solut...

How to determine that a file is in use before deletion?

I'm writing a windows service that might delete a file at some point. Because the service is dealing with regular file IO it's possible that a file can be in use during deletion. Currently I'm trying to delete and react later when an exception happens. Code looks something like this: try { File.Delete(file); ...

Java - where and how should exceptions be used?

Hello. I was reading some things about exception handling in Java, to be able to write better code. OK, I admit, I am guilty; I've used too much try-catch{} blocks, I've used ex.printStackTrace() in the catch, not even using a proper logger (actually the System.out and System.err were redirected to a PrintWriter, so a log was generated)....

Problem with handling exception when sending data by ajax with jQuery

hello, i got following part of one of functions if(continiueSend) { $.ajax ({ type: "POST", url: "mailer.php", data: "somestestdata", timeout: 5000, success: function(a) { alert(a); }, error: function (xhr, ajaxOptions, thrownError) { alert(xhr.status); alert(thrownError);...

java: log exception being thrown

In java, I want to log the exception being thrown from a piece of code: try { doRiskyThing(); } catch(Throwable t) { log.warn("too bad"); throw t; } The problem is that now my method must declare it throws throwable. On the other hand, if I log the exception in a finally block, how do I know what exception is being thrown...

System.InvalidCastException: Specified cast is not valid when inserting a record in LINQ to SQL

On my development machine everything is working fine, however as soon as I publish it to the server I get System.InvalidCastException: Specified cast is not valid This is happening on db.SubmitChanges(); I've check out https://connect.microsoft.com/VisualStudio/feedback/ViewFeedback.aspx?FeedbackID=351358 and it still causes me e...

Dictionary<> is reporting invalid key when it's not

I have some code that adds a Func<short> to a Dictionary<byte, Func<short>> at index 0. Later on, some code within the class that contains the dictionary attempts to extract this Func (via TryGetValue) and execute it, throwing an exception if it does not work. Even though the index being accessed is valid, it throws the exception that si...

Overriding fillInStackTrace for a standard JVM Exceptions

Hi, If I'm using reflection and I want to find if a method is implemented or not, i can use the getMethod() method. This method throws a NoSuchMethodException. Is there a way to overload the fillInStackTrace of this Exception to optimize the performance ? Right now, about 40% of the time is spent in this Method. I'm using a framewor...

Core dump equivalent for the Rails exception

So I got an exception log from my application. I have a call stack, request parameters and all other usual stuff in that log. This is a rare exception and info from the log doesn't contain all details I need to resolve / duplicate the problem. I wonder if there is some way (gem?) to get full dump of Rails application state in case of a...

How to handle same socket in different threads?

I am trying to handle socket in different threads creating runtime failure. See following code. void MySocket::Lock() { m_LockCount++; if( m_LockCount ) { CSocket::Create( 8080 ); } } void MySocket::Unlock() { m_LockCount--; if( !m_LockCount ) { CSocket::Close(); } } I am calling Lock() fro...

Custom exception using NHibernate ISqlExceptionConverter

Hi everybody. I need to register custom exception for NHibernate dialect. I have implemented and registered ISqlExceptionConverter, as shown in NHibernate tests. But when exception in code throws, it is not converted. My conversion code even does not call. My code is really simple: try { using (ISession sess = OpenSession()) ...

App crashes after launching on OS 3.1

Hi folks! I need help to understand the crash log i received from the client. The app works fine on my phone but it crashes with him. I have OS 3.0 installed here while my client has upgraded to OS 3.1. Client reported app crashes usually when he starts the app. Why I am getting EXC_CRASH (SIGABRT)? Can anybody point me in the right d...

Stack call in Exception Handling

According to the design guideline the catching exception should start from more specification exception to System.Exception. like : try { } catch(IOException IOEx) { } catch(ArrayIndexOutOfRangeException AIE) { } ..... catch(Exception ex) { } I heard that CLR tracks the stack to trace the exception one by one to find the matching...