public inbox for [email protected]
 help / color / mirror / Atom feed
From: Muhammad Rizki <[email protected]>
To: Ammar Faizi <[email protected]>,
	GNU/Weeb Mailing List <[email protected]>
Cc: Alviro Iskandar Setiawan <[email protected]>
Subject: Re: [PATCH v2 2/2] daemon: telegram: Handle MySQL error
Date: Sun, 30 Oct 2022 16:49:58 +0700	[thread overview]
Message-ID: <[email protected]> (raw)
In-Reply-To: <[email protected]>

On 30/10/22 12.49, Ammar Faizi wrote:
> +from mysql.connector.errors import OperationalError, DatabaseError
> +
> +
>   	async def __run(self):
>   		print("[__run]: Running...")
> -		for url in self.db.get_atom_urls():
> -			try:
> +		try:
> +			for url in self.db.get_atom_urls():
>   				await self.__handle_atom_url(url)
> -			except:
> -				print(traceback.format_exc())
> +		except (OperationalError, DatabaseError) as e:
> +			await self.handle_db_error(e)

I prefer to do it like this way. What do you think?

  reply	other threads:[~2022-10-30  9:50 UTC|newest]

Thread overview: 5+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2022-10-30  5:49 [PATCH v2 0/2] Automatic recovery from a MySQL restart Ammar Faizi
2022-10-30  5:49 ` [PATCH v2 1/2] daemon: telegram: db: Allow the caller to reconnect Ammar Faizi
2022-10-30  5:49 ` [PATCH v2 2/2] daemon: telegram: Handle MySQL error Ammar Faizi
2022-10-30  9:49   ` Muhammad Rizki [this message]
2022-10-30 12:45     ` Ammar Faizi

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    [email protected] \
    [email protected] \
    [email protected] \
    [email protected] \
    [email protected] \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox