replace 'except:' with 'except Exception:'
what could possibly go wrong
3 files changed, 5 insertions, 5 deletions
diff --git a/synapse/rest/media/v1/_base.py b/synapse/rest/media/v1/_base.py
index bce077becf..95fa95fce3 100644
--- a/synapse/rest/media/v1/_base.py
+++ b/synapse/rest/media/v1/_base.py
@@ -45,7 +45,7 @@ def parse_media_id(request):
except UnicodeDecodeError:
pass
return server_name, media_id, file_name
- except:
+ except Exception:
raise SynapseError(
404,
"Invalid media id token %r" % (request.postpath,),
diff --git a/synapse/rest/media/v1/media_repository.py b/synapse/rest/media/v1/media_repository.py
index 6b50b45b1f..eed9056a2f 100644
--- a/synapse/rest/media/v1/media_repository.py
+++ b/synapse/rest/media/v1/media_repository.py
@@ -310,7 +310,7 @@ class MediaRepository(object):
media_length=length,
filesystem_id=file_id,
)
- except:
+ except Exception:
os.remove(fname)
raise
diff --git a/synapse/rest/media/v1/preview_url_resource.py b/synapse/rest/media/v1/preview_url_resource.py
index 2a3e37fdf4..80114fca0d 100644
--- a/synapse/rest/media/v1/preview_url_resource.py
+++ b/synapse/rest/media/v1/preview_url_resource.py
@@ -367,7 +367,7 @@ class PreviewUrlResource(Resource):
dirs = self.filepaths.url_cache_filepath_dirs_to_delete(media_id)
for dir in dirs:
os.rmdir(dir)
- except:
+ except Exception:
pass
yield self.store.delete_url_cache(removed_media)
@@ -397,7 +397,7 @@ class PreviewUrlResource(Resource):
dirs = self.filepaths.url_cache_filepath_dirs_to_delete(media_id)
for dir in dirs:
os.rmdir(dir)
- except:
+ except Exception:
pass
thumbnail_dir = self.filepaths.url_cache_thumbnail_directory(media_id)
@@ -415,7 +415,7 @@ class PreviewUrlResource(Resource):
dirs = self.filepaths.url_cache_thumbnail_dirs_to_delete(media_id)
for dir in dirs:
os.rmdir(dir)
- except:
+ except Exception:
pass
yield self.store.delete_url_cache_media(removed_media)
|