i have never done anything serious with python, but i found it very handy for what i wanted to do.
I'd like to ask a simple question, how do i raise a custom exception if the third party class already raises it? I am using This class to make asyncronous sql query on my database, and it raises "UNIQUE constraint failed" which is fine for me but i don't want it to log it.
This is my simple code
try:
querypost = "INSERT INTO post(link,Commenti,data) VALUES('"+link+"','"+str(n_commenti)+"','"+str(data)+"')"
sql_worker.execute(querypost);
except (IntegrityError) as error:
print("test")
The problem with this is that it never reaches my print and it prints his own excpetion.
How do i make it shut up?
EDIT:
This piece of code made the logger suppress the unwanted message:
logging.getLogger("sqlite3worker").setLevel(logging.CRITICAL)
Thanks to @AChampion