Deutsch   English   Français   Italiano  
<87a5e4ygc1.fsf@zedat.fu-berlin.de>

View for Bookmarking (what is this?)
Look up another Usenet article

Path: ...!fu-berlin.de!uni-berlin.de!not-for-mail
From: "Loris Bennett" <loris.bennett@fu-berlin.de>
Newsgroups: comp.lang.python
Subject: Re: FileNotFoundError thrown due to file name in file, rather than file itself
Date: Tue, 12 Nov 2024 10:03:10 +0100
Organization: FUB-IT, Freie =?utf-8?Q?Universit=C3=A4t?= Berlin
Lines: 18
Message-ID: <87a5e4ygc1.fsf@zedat.fu-berlin.de>
References: <87v7wt986z.fsf@zedat.fu-berlin.de>
	<CAPTjJmoJErFTE-oS2X_Z+2yC6bMXvHZi0=CxkGhWnVtd4Gacvw@mail.gmail.com>
	<mailman.96.1731374262.4695.python-list@python.org>
Mime-Version: 1.0
Content-Type: text/plain
X-Trace: news.uni-berlin.de gOehtvHKXYuZXTyzca9enwvWfAukXwUVDgr8Ui3fHPiGoD
Cancel-Lock: sha1:k/vcnI5AMQA+rgwn6gBBnahP+TU= sha1:Dcu0p2ooIs7PrAxu+z+WWGSMldQ= sha256:4f0IzUZEt6DcTO13uGsm5way6qps+KBZInUN/UAh/MI=
User-Agent: Gnus/5.13 (Gnus v5.13) Emacs/28.2 (gnu/linux)
Bytes: 1643

Chris Angelico <rosuav@gmail.com> writes:

> On Tue, 12 Nov 2024 at 01:59, Loris Bennett via Python-list
> <python-list@python.org> wrote:
>> 2. In terms of generating a helpful error message, how should one
>>    distinguish between the config file not existing and the log file not
>>    existing?
>
> By looking at the exception's attributes rather than assuming and
> hard-coding the path in your message? Or, even better, just let the
> exception bubble.

I didn't consider letting the exception bubble as is the top of the
code for a CLI program.  I was hoping to just catch what I thought might
be a common error of the config file being missing.

-- 
This signature is currently under constuction.