Skip to content

Commit 9d5a6a6

Browse files
committed
Being more specific for FileNotFoundError
1 parent 70419fe commit 9d5a6a6

File tree

1 file changed

+3
-3
lines changed

1 file changed

+3
-3
lines changed

astroquery/query.py

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -114,7 +114,7 @@ def from_cache(self, cache_location):
114114
response = pickle.load(f)
115115
if not isinstance(response, requests.Response):
116116
response = None
117-
except OSError: # TODO: change to FileNotFoundError once drop py2 support
117+
except FileNotFoundError:
118118
response = None
119119
if response:
120120
log.debug("Retrieving data from {0}".format(request_file))
@@ -130,8 +130,8 @@ def remove_cache_file(self, cache_location):
130130
if os.path.exists(request_file):
131131
os.remove(request_file)
132132
else:
133-
raise OSError(f"Tried to remove cache file {request_file} but "
134-
"it does not exist")
133+
raise FileNotFoundError(f"Tried to remove cache file {request_file} but "
134+
"it does not exist")
135135

136136

137137
class LoginABCMeta(abc.ABCMeta):

0 commit comments

Comments
 (0)