exception

python logger logging same entry numerous times

I have a such logger initializing function: def generate_logger(): import logging LOG_FILENAME = os.path.join(PROJECT_DIR, "mylog.log") FORMAT = "%(asctime)s : %(message)s" logger = logging.getLogger() logger.setLevel(logging.INFO) fh = logging.FileHandler(LOG_FILENAME) formatter = logging.Formatter(FORMAT) ...

javax.persistence.OptimisticLockException + org.hibernate.StaleObjectStateException

Hi! I'm catching javax.persistence.OptimisticLockException which works great, but I'm getting the stacktrace of StaleObjectStateException in my server log. I've checked and the getCause() on OptimisticLockException returns StaleObjectStateException, but why is it printed out to server.log? It's really annoying, I'm writing a test, where...

How to handle AccessViolationException

I am using a COM object (MODI) from within my .net application. The method I am calling throws a System.AccessViolationException, which is intercepted by Visual Studio. The odd thing is that I have wrapped my call in a try catch, which has handlers for AccessViolationException, COMException and everything else, but when Visual Studio (...

Unsafe to throw exceptions from statically linked C++ libraries?

I've heard that throwing exceptions in/from a C++ library could be potentially dangerous, particularly with DLLs, and particularly if the calling code and the library are compiled with different compilers. Is there any truth to this? Is it safe as long as I stick to static libraries? Note that I am not talking about internal use of excep...

Problem handling exception gracefully

I am working on an app which records input from microphones to .wav files using NAudio. My Recorder class uses a BackgroundWorker to record. I start recording and keep doing so until either 10s have elapsed, or the user requested a cancellation. This works fine in most cases, except one. In debug, when I unplug the recording device midwa...

Updating UITableView will cause exception

I have UITableViewController subclassed and implemented the following NSFetchedResultsController with its delegates tableView:sectionForSectionIndexTitle:atIndex: tableView:titleForHeaderInSection: In controller:didChangeObject:atIndexPath:forChangeType:newIndexPath: case NSFetchedResultsChangeMove: [tableView deleteRowsAtIndexP...

exception for notifying that subclass should implement a method in python

Hi! suppose I want to create an abstract class in python with some methods to be implemented by subclasses. (in Python) for example: class Base(): def f(self): print "Hello." self.g() print "Bye!" class A(Base): def g(self): print "I am A" class B(Base): def g(self): print "I am B...

UISearchDisplayController : application is showing exception

Hi, Im trying to work with UISearchDisplay controller the application is launching correctly. When i start typing in the UISearchbarController its showing the following exception and exiting the application. The exception is as follows: [BrowserViewController tableView:numberOfRowsInSection:]: unrecognized selector sent to instance 0x5...

java.net.ssl.sslexception: comes when launch Android Application

there is a strange problem comes when i run my android application. there is a exception of java.net.ssl.sslexception occurs. but in iphone it does not create the problem in iphone its run successfully. please find some solutions to solve this problem in android. same application in blackberry will also occurs same problem. please find s...

Handling interrupted exception of AsyncTask in Android?

Hi, I am using AsyncTask in my application. The problem is that when server is down the AsyncTask throws an Interrupted exception. How to track that whether server is down or not. ` HttpGet httpget = new HttpGet(urls[i]); ResponseHandler<String> responseHandler = new BasicResponseHandler(); content = httpClient.execute(httpget, re...

Rails and attr_accessible: is there a way to raise an exception if a non-mass-assignable attribute is mass-assigned?

Is there a way to have rails raise an error if an attempt is made to mass-assign attributes that aren't allowed by attr_accessible? This would be handy in development to remind me why my shiny new model isn't working, and also good to log in production in order to detect malicious activity. I'm using rails 2.3.8 but will probably soon ...

What is the value of Exception factories?

In looking at some code reflected from the WCF libraries, I'm seeing a pattern used to create exceptions: if(argument == null) { throw Error.ArgumentNull("argument"); } Null arguments being the simplest example, with other types of exceptions available through the static error class. What is the value of this factory pattern? Why...

System.NotSupportedException. The URI prefix is not recognized.

I have a WCF service, in two machine in Preproduction environment, machine A and machine B. Only in machine B, the service fails when I call it (from biztalk proccess), another machine is right. The configuration of service in both machines is the same. I get this error: System.NotSupportedException, mscorlib, Version=2.0.0.0, ...

Nested excpetion variable names

Given the following code: try // code1 try // code2 catch ex as exception end try // code3 catch ex as exception end try Are there any side effects to naming the two exception variables the same or should they have different names? ...

Java - How to do Python's Try Except Else

How do I do a try except else in Java like I would in Python? Example: try: something() except SomethingException,err: print 'error' else: print 'succeeded' I see try and catch mentioned but nothing else. ...

Why does pressing numlock crash OCaml opengl program?

I don't have any experience with openGL, so maybe I'm just missing something. I have this ocaml code using lablGL. To compile I use ocamlopt -I +lablGL lablglut.cmxa lablgl.cmxa gl.ml -o gl.opt or ocamlc -I +lablGL lablglut.cma lablgl.cma gl.ml -o gl.byte let keyboard ~key ~x ~y = match key with | 27 -> exit 0 | _ -> ignor...

How to disable PHP cutting off parts of long arguments in exception stack trace?

Sometimes things like this happen: #0 /some/path(1): Class_Name->exception_trigger() #1 /some/other/path(5): get_to('/some/long/path/tha...') How to I get to see the full arguments for everything? Thanks ...

Memory deallocation and exceptions

Hi, I have a question regarding memory deallocation and exceptions. when I use delete to delete an object created on the heap . If an exception occurs before this delete is the memory going to leak or this delete is going to execute ? ...

Javascript eval() Exception - line number

In JavaScript I have a var str = ".a long string that contains many lines..." In case of exception that caused by eval(str); I had like to catch it and print the the line number that caused the exception. (the line internal to str..) Is it possible? EDIT As part of the Alligator project (http://github.com/mrohad/Alligator), an applica...

"We do not use C++ exceptions" — What's the alternative? Let it crash?

"We do not use C++ exceptions." If you don't use exceptions, what happens when there's an error? You just let the program crash? ...