exception

Return values and exceptions for PHP functions

I'm reading some books on PHP (specifically "PHP and MySQL Web Development" by Welling and Thomson) and I'm also a fresh undergrad. I was a bit curious why the author decided to choose two different ways to terminate the execution of a function, e.g. if (!$result) { throw new Exception('Password could not be changed.'); } else { ...

Stop an operation without stopping the module in python

Well, I have made a module that allows you to copy a file to a directory easier. Now, I also have some "try's" and "except's" in there to make sure it doesn't fail in the big messy way and doesn't close the terminal, but I also want it to display different error messages when a wrong string or variable is put in, and end the module, but ...

jquery animate, but not specific li class

Hi all, I'm using jquery to change/animate bg positions of a menu item, but I need it to not do anything if the li class is "active", but I can't seem to figure out how to use the not selector (or even if it's appropriate for this case?). Here's the code: <div id="menuHolder"> <ul> <li class="active"><a href="/">menu 1</a></li> ...

Run time exception handling (like Divide by zero) in JVM (Java)or CLR (C#)

Hello, How does JVM or for that matter CLR (Common language runtime) handles divided by zero? Does it check denominator every time, before executing divide instruction? Or is it handled using call back function which get invoked when "divide by zero" trap raised by processor? Any input will be appreciated. Thank you, Alan ...

Do not understand exception, cant convert to readable text

I have a hash table which stores IPs as strings for the key and an object of my creation in the corresponding value. I keep getting an exception at foreach (DictionaryEntry info in MasterHash.Keys). More specifically it happens as the debugger gets to DictionaryEntry. I have tried to provoke a message from my try catch statement but the...

use of "throws IOException" in java file handling

why we use 'Throws IOException' in java File handling. i mean what is the purpose of using these two words in File handling?? Please help... ...

What is the proper error message to supply to Google Guava's Preconditions.* methods?

For example when using Preconditions.checkArgument, is the error message supposed to reflect the passing case or the failing case of the check in question? import static com.google.common.base.Preconditions.*; void doStuff(int a, int b) { checkArgument(a == b, "a == b"); // OR checkArgument(a == b, "a != b"); } ...

c# program loses filepaths after autostart

So I got a nice piece of code that allows me to enable autostart of program by clicking one button and disable by clicking other (it uses "SetValue" to create register entry and "DeleteValue" to discard it). I used it in simple program, and it did started with Windows as I wanted. The problem started when I used the same code in more sop...

Exception Safety in Qt

Wikipedia says that "A piece of code is said to be exception-safe, if run-time failures within the code will not produce ill effects, such as memory leaks, garbled stored data, or invalid output. Exception-safe code must satisfy invariants placed on the code even if exceptions occur." And it seems that we need exception handling for ex...

win32 system unhandled exception

Hi,I want to call third party software in .net application (C#) the code is as follows: Process proc = new Process(); proc.EnableRaisingEvents = false; \\name of the file proc.StartInfo.FileName = "filename"; \\Path where the file is located proc.StartInfo.Arguments = "filepath"; proc.Start(); but its throwing an exception Win32 sys...

Windows service gives error 1053 - System.IO.DirectoryNotFoundException

I have a small console app containing a web server written in c#. When trying to convert it to windows service, i get a error 1053, and when i view the error log it shows: Application: YCSWebServerService.exe Framework Version: v4.0.30319 Description: The process was terminated due to an unhandled exception. Exception Info: System.IO.Di...

Android, ListView IllegalStateException: "The content of the adapter has changed but ListView did not receive a notification"

What I want to do: run a background thread which calculates ListView contents and update ListView partially, while results are calculated. What I know I have to avoid: I cannot mess with ListAdapter contents from background thread, so I inherited AsyncTask and publish result (add entries to adapter) from onProgressUpdate. My Adapter use...

SharpDevelop equivalent of Visual Studio's "Break on exceptions"

In Visual Studio, there's a debugger setting labelled "Break on exceptions" or something like that. It drops into the debugger whenever an exception is raised (that is, on the first pass of the two pass exception mechanics), regardless of whether the exception will be handled or not. This is a very useful feature, and I try to keep it ...

(Unknown Source) in Exception stack trace

Background This question is related to Why does String.valueOf(null) throw a NullPointerException? Consider the following snippet: public class StringValueOfNull { public static void main(String[] args) { String.valueOf(null); // programmer intention is to invoke valueOf(Object), but instead // code in...

Exception not showing

I have : public class Person : INotifyPropertyChanged { private string _name; public int Age { get; set; } public string Name { get { return _name; } set { if (!String.IsNullOrEmpty(_name)) { if (String.IsNullOrE...

WebFaultException to pass back an XML message rather than string?

In my RESTful services layer, any exceptions that bubble up to me are caught as Fault Exceptions. Within that FaultException, there's a custom XML message that contains <errorNumber>, <errorCode> and a <message>. I re-package the exception as a WebFaultException so I can set the HttpStatusCode for the response header to 400, 401, 404, et...

[Android] MapView ConcurrentModificationException

Hello everyone, As the title suggest i have (sometimes) a concurrentmodificationexception while trying to create a route between two locations ... Here is my code (and in case you're wondering MyOverlay does not try to access the other Overlays in the map) private class fillRouteTask extends AsyncTask<Void, GeoPoint, Void> { /**...

Problem with List<E> properties in exceptions thrown from JAX-WS/EJB3 web service

I have a (JAX-WS/EJB3) web service which has operations that can throw ValidationExceptions, which holds a list of standard POJOs that represent stuff that didn't pass validation. This list causes marshaling to break. Firstly, the exception class: public class ValidationException extends Exception { private final List<ValidationErr...

how do I catch all exceptions in iphone?

I need to catch ALL exceptions and errors in an iphone app. Obviously, this is only for really strange cases where the exception or error is totally unexpected. In those cases, it would be nice to log the error or something, so as to get knowledge of the issue and fix it in the future. Do you know a way to catching ALL exceptions or err...

I get frequently SQLiteDoneException when querying one value, why?

I get frequently SQLiteDoneException, 06-29 02:03:34.816: WARN/System.err(30470): android.database.sqlite.SQLiteDoneException: not an error 06-29 02:03:34.816: WARN/System.err(30470): at android.database.sqlite.SQLiteStatement.native_1x1_string(Native Method) 06-29 02:03:34.816: WARN/System.err(30470): at android.database.sqlite...