replace except with except Exception

This commit is contained in:
2023-07-16 16:58:34 -04:00
parent 343fe4357c
commit 14a315a673
14 changed files with 33 additions and 30 deletions

View File

@ -63,7 +63,7 @@ class AimedbProtocol(Protocol):
try:
decrypted = cipher.decrypt(data)
except:
except Exception:
self.logger.error(f"Failed to decrypt {data.hex()}")
return None

View File

@ -58,7 +58,7 @@ class BaseData:
self.logger.error(f"UnicodeEncodeError error {e}")
return None
except:
except Exception:
try:
res = self.conn.execute(sql, opts)
@ -70,7 +70,7 @@ class BaseData:
self.logger.error(f"UnicodeEncodeError error {e}")
return None
except:
except Exception:
self.logger.error(f"Unknown error")
raise

View File

@ -130,7 +130,7 @@ class FE_Gate(FE_Base):
if b"e" in request.args:
try:
err = int(request.args[b"e"][0].decode())
except:
except Exception:
err = 0
else:

View File

@ -68,10 +68,13 @@ class MuchaServlet:
return b"RESULTS=000"
# TODO: Decrypt S/N
b_key = b""
for x in range(8):
b_key += req.sendDate[(x - 1) & 7].encode()
#cipher = Blowfish.new(req.sendDate.encode(), Blowfish.MODE_ECB)
#sn_decrypt = cipher.decrypt(bytes.fromhex(req.serialNum))
#self.logger.debug(f"Decrypt SN to {sn_decrypt.hex()}")
cipher = Blowfish.new(b_key, Blowfish.MODE_ECB)
sn_decrypt = cipher.decrypt(bytes.fromhex(req.serialNum))
self.logger.debug(f"Decrypt SN to {sn_decrypt.hex()}")
resp = MuchaAuthResponse(
f"{self.config.mucha.hostname}{':' + str(self.config.allnet.port) if self.config.server.is_develop else ''}"
@ -131,7 +134,7 @@ class MuchaServlet:
return ret
except:
except Exception:
self.logger.error(f"Error processing mucha request {data}")
return None
@ -143,7 +146,7 @@ class MuchaServlet:
return urlencode.encode()
except:
except Exception:
self.logger.error("Error processing mucha response")
return None