1
0

don't use bare except

use "except Exception", or if really needed explicitly "except BaseException"
This commit is contained in:
SomberNight
2023-04-23 01:33:12 +00:00
parent 6848b8f375
commit 312f2641e7
57 changed files with 118 additions and 118 deletions

View File

@@ -1470,7 +1470,7 @@ def extract_nodeid(connect_contents: str) -> Tuple[bytes, Optional[str]]:
invoice = lndecode(connect_contents)
nodeid_bytes = invoice.pubkey.serialize()
nodeid_hex = nodeid_bytes.hex()
except:
except Exception:
# node id as hex?
nodeid_hex = connect_contents
if rest == '':
@@ -1479,7 +1479,7 @@ def extract_nodeid(connect_contents: str) -> Tuple[bytes, Optional[str]]:
node_id = bfh(nodeid_hex)
if len(node_id) != 33:
raise Exception()
except:
except Exception:
raise ConnStringFormatError(_('Invalid node ID, must be 33 bytes and hexadecimal'))
return node_id, rest