Allow MetadataFactory to recover from bad HTML files

This change allows MetadataFactory.iterate_folders to recognize when
MetadataFactory has retrieved a malformed HTML file, or an HTML file
that does not contain the table and rows that it expects to see.

If the URL is correct, it should retrieve the right page, but this is
not guaranteed, and MetadataFactory should be able to recover and
generate an appropriate error message.

One possible situation where this kind of error might occur could be
when the user is connected to a public WIFI network, but not logged in.
The router would redirect aqt to the network login page, and aqt would
have no way of knowing that it did not receive the correct page.
Aqt should be resilient to this kind of error.
This commit is contained in:
Dave Dalcino
2022-04-19 18:26:21 -07:00
parent 320df539c0
commit e8672f3fbe
3 changed files with 56 additions and 16 deletions

View File

@@ -40,6 +40,12 @@ class AqtException(Exception):
["* " + suggestion for suggestion in self.suggested_action]
)
def append_suggested_follow_up(self, suggestions: Iterable[str]):
if self.suggested_action:
self.suggested_action = [*self.suggested_action, *suggestions]
else:
self.suggested_action = suggestions
class ArchiveDownloadError(AqtException):
pass