[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
bug#60100: 29.0.60; project-current is not resilient
From: |
Juri Linkov |
Subject: |
bug#60100: 29.0.60; project-current is not resilient |
Date: |
Sun, 18 Dec 2022 10:38:30 +0200 |
User-agent: |
Gnus/5.13 (Gnus v5.13) Emacs/30.0.50 (x86_64-pc-linux-gnu) |
tags 60100 + notabug
close 60100 29.0.60
quit
>> Is this intentional that
>> ```
>> (project-current nil "/tmp/nonexistent/")
>> ```
>> raises the error
>> Debugger entered--Lisp error: (file-missing "Opening directory" "No
>> such file or directory" "/tmp/nonexistent")
>> instead of silently returning nil.
>
> I would say this is expected.
>
> How could we avoid this? By adding a file-exists-p check somewhere inside,
> right? And failing silently if it returns nil.
>
> Right now the caller code needs to use that check. Or, more likely, figure
> out why they are passing in a directory that does not exist.
The problem is that callers are unaware that they need to handle this case
until they get the error that then get to use file-exists-p. But actually
this problem is not specific to project. Many other commands fail in such
circumstances too. For example, 'dired-jump' raises an error on a deleted
directory as well:
(file-missing "Setting current directory" "No such file or directory")
So now closing.