Include local file and cached resource handling inside nice try/except error printing.

This commit is contained in:
Solderpunk 2023-11-16 19:13:20 +01:00
parent 91ff51a0ef
commit 681b11b8a4
1 changed files with 13 additions and 13 deletions

26
av98.py
View File

@ -328,21 +328,21 @@ you'll be able to transparently follow links to Gopherspace!""")
return
# Use local file, use cache, or hit the network if resource is not cached
if gi.scheme == "file":
mime = self._handle_local_file(gi)
self.active_raw_file = gi.path
elif check_cache and self.options["cache"] and self.cache.check(gi.url):
mime, self.active_raw_file = self.cache.get(gi.url)
self.log["cache_hits"] += 1
else:
try:
try:
if gi.scheme == "file":
mime = self._handle_local_file(gi)
self.active_raw_file = gi.path
elif check_cache and self.options["cache"] and self.cache.check(gi.url):
mime, self.active_raw_file = self.cache.get(gi.url)
self.log["cache_hits"] += 1
else:
gi, mime = self._fetch_over_network(gi)
self.active_raw_file = self.raw_file_buffer
except UserAbortException:
return
except Exception as err:
self._print_friendly_error(err)
return
except UserAbortException:
return
except Exception as err:
self._print_friendly_error(err)
return
# Render gemtext, update index
if mime == "text/gemini":