mirror of
				https://github.com/psycopg/psycopg2.git
				synced 2025-10-31 07:47:30 +03:00 
			
		
		
		
	Added example about how to deal with the cursor bad exception.
This commit is contained in:
		
							parent
							
								
									885dbf6428
								
							
						
					
					
						commit
						53f3248976
					
				|  | @ -275,7 +275,13 @@ The ``cursor`` class | ||||||
|         .. note::  |         .. note::  | ||||||
| 
 | 
 | ||||||
|             According to the |DBAPI|_, the exception raised for a cursor out |             According to the |DBAPI|_, the exception raised for a cursor out | ||||||
|             of bound should have been :exc:`!IndexError`. |             of bound should have been :exc:`!IndexError`.  The best option is | ||||||
|  |             probably to catch both exceptions in your code:: | ||||||
|  | 
 | ||||||
|  |                 try: | ||||||
|  |                     cur.scroll(1000 * 1000) | ||||||
|  |                 except (ProgrammingError, IndexError), exc: | ||||||
|  |                     deal_with_it(exc) | ||||||
| 
 | 
 | ||||||
| 
 | 
 | ||||||
|     .. attribute:: arraysize |     .. attribute:: arraysize | ||||||
|  |  | ||||||
		Loading…
	
		Reference in New Issue
	
	Block a user