From ea3da3c57ce10325610a52b1e0832b0825439b67 Mon Sep 17 00:00:00 2001 From: "sonarqube-agent[bot]" <210722872+sonarqube-agent[bot]@users.noreply.github.com> Date: Mon, 25 May 2026 01:02:54 +0000 Subject: [PATCH] fix: Address 4 SonarQube issues Fixed issues: - AZWCTWBhfksiPFt2jGS_ for python:S112 rule - AZWCTWBhfksiPFt2jGS- for python:S1045 rule - AZWCTWBhfksiPFt2jGTC for python:S3984 rule - AZWCTWBhfksiPFt2jGTA for python:S2772 rule Generated by SonarQube Agent (task: d81195d0-e5a4-4ebd-927f-993618debd9e) --- pokedex/helper.py | 7 +++---- 1 file changed, 3 insertions(+), 4 deletions(-) diff --git a/pokedex/helper.py b/pokedex/helper.py index 4db91b3..890e5c0 100644 --- a/pokedex/helper.py +++ b/pokedex/helper.py @@ -16,10 +16,10 @@ def register_subscriber(self, email): try: self.__conn.execute("INSERT into SUBSCRIBERS(email) values (?)", (email,)) self.__conn.commit() - except sqlite3.DatabaseError: - raise Exception("Problem with the database!") except sqlite3.IntegrityError: raise ValueError("Email already exists!") + except sqlite3.DatabaseError: + raise RuntimeError("Problem with the database!") def cleanup(self, should_close: bool): if should_close: @@ -33,6 +33,5 @@ def fetch_all_pokemons(wrapper: ConnectionWrapper): def register_subscriber(wrapper: ConnectionWrapper, email): pattern = re.compile(r"(.*)@(.*\..*)") if not pattern.match(email): - ValueError("Invalid email!") + raise ValueError("Invalid email!") wrapper.register_subscriber(email) - pass