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