From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on gnuweeb.org X-Spam-Level: X-Spam-Status: No, score=-0.8 required=5.0 tests=ALL_TRUSTED,DKIM_SIGNED, DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,NO_DNS_FOR_FROM autolearn=no autolearn_force=no version=3.4.6 Received: from mail-lj1-f175.google.com (mail-lj1-f175.google.com [209.85.208.175]) by gnuweeb.org (Postfix) with ESMTPSA id C19F57E375 for ; Sun, 8 Jan 2023 07:15:51 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=gnuweeb.org; s=default; t=1673162151; bh=+J+LZ4pLHGCmjfccELUjMM+Pl42LWq3No7uIwYgRcJY=; h=References:In-Reply-To:From:Date:Subject:To:Cc:From; b=liNPCUAozPOyizJ3dLczuVu2KlYph2o+esVNDePyZylfpQ7WX8nc2mTtPeLcFySw9 Mm/lyrtTO8Be4PYLTX92uCQ4ObHUaflGcRUol8Op53W+9vhI3Q5YWdLG7/O9tC8+jc MJrI3hw+0gJCMSwL7jCUXWWZ/LMN8RNvBUYUUW+OVM4HlEN7ZtYe8KzUNQvase2xkj hYbIRJTVbeM4DwchNJVewBga2AOB5SGORto2vbWHiTczpKDnEufvtXFYYEG/ggIbby PvMwUikje0lGgHflSk5bM8+dG4pu2fiJW4wMGxtk0Q2pY23zgtu4jinFvL3QzQ2khU 9rjrW5hyvQp1Q== Received: by mail-lj1-f175.google.com with SMTP id g14so5689784ljh.10 for ; Sat, 07 Jan 2023 23:15:51 -0800 (PST) X-Gm-Message-State: AFqh2kpMgjfqBSAKX4xIbZ7L3Al0mHS1C2V6cVpqepGQa4jO0miGBYCI c7dg2mTkIuUb1oSlVUzV+K7VIicqUeBcHTaeLhQ= X-Google-Smtp-Source: AMrXdXvyn+wzVfyIUQUpJ2wO9ebTWZexv1yOgkl7RZ7w9cEKayEJSFjtdHeDXxVKJU2ZdGAnjX89wW2uKdvL7j1XLpQ= X-Received: by 2002:a05:651c:88c:b0:281:136b:4a8d with SMTP id d12-20020a05651c088c00b00281136b4a8dmr497729ljq.349.1673162149948; Sat, 07 Jan 2023 23:15:49 -0800 (PST) MIME-Version: 1.0 References: <20230108061543.1780-1-kiizuha@gnuweeb.org> <20230108061543.1780-6-kiizuha@gnuweeb.org> In-Reply-To: From: Alviro Iskandar Setiawan Date: Sun, 8 Jan 2023 14:15:38 +0700 X-Gmail-Original-Message-ID: Message-ID: Subject: Re: [PATCH v2 05/11] telegram: Implement the DaemonException() and refactor report_err() To: Ammar Faizi Cc: Muhammad Rizki , "GNU/Weeb Mailing List" Content-Type: text/plain; charset="UTF-8" List-Id: On Sun, Jan 8, 2023 at 1:36 PM Ammar Faizi wrote: > On Sun, Jan 08, 2023 at 01:15:37PM +0700, Muhammad Rizki wrote: > > @@ -77,8 +78,9 @@ class Bot(): > > await self.__handle_atom_url(url) > > except (OperationalError, DatabaseError) as e: > > await self.handle_db_error(e) > > - except: > > - await self.client.report_err(url) > > + except DaemonException as e: > > + e.set_atom_url(url) > > + await self.client.report_err(e) > > What is wrong with you? > > I have told you like 3 times about this. You need to handle a generic > exception as well. Because if it throws an exception inside > `self.db.get_atom_urls()`, we will not get the report. > > An exception that is raised inside `self.db.get_atom_urls()` will not > be converted into a DaemonException instance. That is why it's possible > to get an exception that's not an instance of (OperationalError, > DatabaseError, DaemonException). Maybe you need to give a small pseudo-code so it's clear to him. My understanding will be adding an "except" statement without specifying any exception class name, no?