zephyr_mirror: Replace bare excepts with 'except Exception'.
(imported from commit 857212e0e5116471e418d37845550108c0a47d2b)
This commit is contained in:
		
							parent
							
								
									ab68503fcf
								
							
						
					
					
						commit
						074316105b
					
				
					 1 changed files with 7 additions and 7 deletions
				
			
		|  | @ -186,7 +186,7 @@ def update_subscriptions_from_humbug(): | ||||||
|         else: |         else: | ||||||
|             logger.error("Error getting public streams:\n%s" % res) |             logger.error("Error getting public streams:\n%s" % res) | ||||||
|             return |             return | ||||||
|     except: |     except Exception: | ||||||
|         logger.exception("Error getting public streams:") |         logger.exception("Error getting public streams:") | ||||||
|         return |         return | ||||||
|     streams_to_subscribe = [] |     streams_to_subscribe = [] | ||||||
|  | @ -222,7 +222,7 @@ def maybe_restart_mirroring_script(): | ||||||
|         while True: |         while True: | ||||||
|             try: |             try: | ||||||
|                 os.execvp(os.path.join(options.root_path, "user_root", "zephyr_mirror_backend.py"), sys.argv) |                 os.execvp(os.path.join(options.root_path, "user_root", "zephyr_mirror_backend.py"), sys.argv) | ||||||
|             except: |             except Exception: | ||||||
|                 logger.exception("Error restarting mirroring script; trying again... Traceback:") |                 logger.exception("Error restarting mirroring script; trying again... Traceback:") | ||||||
|                 time.sleep(1) |                 time.sleep(1) | ||||||
| 
 | 
 | ||||||
|  | @ -350,7 +350,7 @@ def decode_unicode_byte_strings(zeph): | ||||||
|         if isinstance(zeph[field], str): |         if isinstance(zeph[field], str): | ||||||
|             try: |             try: | ||||||
|                 decoded = zeph[field].decode("utf-8") |                 decoded = zeph[field].decode("utf-8") | ||||||
|             except: |             except Exception: | ||||||
|                 decoded = zeph[field].decode("iso-8859-1") |                 decoded = zeph[field].decode("iso-8859-1") | ||||||
|             zeph[field] = decoded |             zeph[field] = decoded | ||||||
|     return zeph |     return zeph | ||||||
|  | @ -397,7 +397,7 @@ def zephyr_to_humbug(options): | ||||||
|                                 (zeph.get('stream', zeph.get('recipient')), |                                 (zeph.get('stream', zeph.get('recipient')), | ||||||
|                                  zeph['sender'])) |                                  zeph['sender'])) | ||||||
|                     send_humbug(zeph) |                     send_humbug(zeph) | ||||||
|                 except: |                 except Exception: | ||||||
|                     logger.exception("Could not send saved zephyr:") |                     logger.exception("Could not send saved zephyr:") | ||||||
|                     time.sleep(2) |                     time.sleep(2) | ||||||
| 
 | 
 | ||||||
|  | @ -536,7 +536,7 @@ def maybe_forward_to_zephyr(message): | ||||||
|             return |             return | ||||||
|         try: |         try: | ||||||
|             forward_to_zephyr(message) |             forward_to_zephyr(message) | ||||||
|         except: |         except Exception: | ||||||
|             # Don't let an exception forwarding one message crash the |             # Don't let an exception forwarding one message crash the | ||||||
|             # whole process |             # whole process | ||||||
|             logger.exception("Error forwarding message:") |             logger.exception("Error forwarding message:") | ||||||
|  | @ -672,7 +672,7 @@ def parse_zephyr_subs(verbose=False): | ||||||
|                 if verbose: |                 if verbose: | ||||||
|                     print >>sys.stderr, "Skipping subscription to unsupported class name: [%s]" % (line,) |                     print >>sys.stderr, "Skipping subscription to unsupported class name: [%s]" % (line,) | ||||||
|                 continue |                 continue | ||||||
|         except: |         except Exception: | ||||||
|             if verbose: |             if verbose: | ||||||
|                 print >>sys.stderr, "Couldn't parse ~/.zephyr.subs line: [%s]" % (line,) |                 print >>sys.stderr, "Couldn't parse ~/.zephyr.subs line: [%s]" % (line,) | ||||||
|             continue |             continue | ||||||
|  | @ -687,7 +687,7 @@ def fetch_fullname(username): | ||||||
|         out, _err_unused = proc.communicate() |         out, _err_unused = proc.communicate() | ||||||
|         if proc.returncode == 0: |         if proc.returncode == 0: | ||||||
|             return out.split(':')[4].split(',')[0] |             return out.split(':')[4].split(',')[0] | ||||||
|     except: |     except Exception: | ||||||
|         logger.exception("Error getting fullname for %s:" % (username,)) |         logger.exception("Error getting fullname for %s:" % (username,)) | ||||||
| 
 | 
 | ||||||
|     return username |     return username | ||||||
|  |  | ||||||
		Loading…
	
	Add table
		Add a link
		
	
		Reference in a new issue
	
	 Tim Abbott
						Tim Abbott