From 17e171972c342e8602accc250a8a921a694766bd Mon Sep 17 00:00:00 2001 From: =?utf8?q?Roland=20H=C3=A4der?= Date: Fri, 9 Jun 2023 04:28:29 +0200 Subject: [PATCH] Continued: - catch BaseException (very generic catch, but wanted here) --- fba/commands.py | 2 +- fba/fba.py | 2 -- fba/federation/mastodon.py | 2 +- fba/federation/pleroma.py | 2 +- 4 files changed, 3 insertions(+), 5 deletions(-) diff --git a/fba/commands.py b/fba/commands.py index 65ddb03..a14d878 100644 --- a/fba/commands.py +++ b/fba/commands.py @@ -243,7 +243,7 @@ def fetch_blocks(args: argparse.Namespace): # DEBUG: print("DEBUG: Committing changes ...") fba.connection.commit() - except Exception as exception: + except BaseException as exception: print(f"ERROR: blocker='{blocker}',software='{software}',exception[{type(exception)}]:'{str(exception)}'") else: print("WARNING: Unknown software:", blocker, software) diff --git a/fba/fba.py b/fba/fba.py index 49b1044..1020416 100644 --- a/fba/fba.py +++ b/fba/fba.py @@ -761,8 +761,6 @@ def find_domains(tag: bs4.element.Tag) -> list: # DEBUG: print(f"DEBUG: tag[]={type(tag)} - CALLED!") if not isinstance(tag, bs4.element.Tag): raise ValueError(f"Parameter tag[]={type(tag)} is not type of bs4.element.Tag") - elif not isinstance(tag, bs4.element.Tag): - raise KeyError("Cannot find table with instances!") elif len(tag.select("tr")) == 0: raise KeyError("No table rows found in table!") diff --git a/fba/federation/mastodon.py b/fba/federation/mastodon.py index abbe8b8..3106065 100644 --- a/fba/federation/mastodon.py +++ b/fba/federation/mastodon.py @@ -256,7 +256,7 @@ def fetch_blocks(domain: str, origin: str, nodeinfo_url: str): # DEBUG: print("DEBUG: Committing changes ...") fba.connection.commit() - except Exception as exception: + except BaseException as exception: print(f"ERROR: domain='{domain}',software='mastodon',exception[{type(exception)}]:'{str(exception)}'") # DEBUG: print("DEBUG: EXIT!") diff --git a/fba/federation/pleroma.py b/fba/federation/pleroma.py index 4c5d726..764209c 100644 --- a/fba/federation/pleroma.py +++ b/fba/federation/pleroma.py @@ -194,7 +194,7 @@ def fetch_blocks(domain: str, origin: str, nodeinfo_url: str): entry["reason"] = reason["reason"] fba.connection.commit() - except Exception as exception: + except BaseException as exception: print(f"ERROR: domain='{domain}',software='pleroma',exception[{type(exception)}]:'{str(exception)}'") # DEBUG: print("DEBUG: EXIT!") -- 2.39.5