[m-users.] io.error type
Sean Charles (emacstheviking)
objitsu at gmail.com
Fri Feb 4 19:27:46 AEDT 2022
I just try to open files, if it fails, I use error_message() to explain why and leave it at that...is there some *specific* reason you need to know the file didn't exist?
> On 4 Feb 2022, at 07:05, Volker Wysk <post at volker-wysk.de> wrote:
> Am Freitag, dem 04.02.2022 um 16:51 +1100 schrieb Julien Fischer:
>> On Fri, 4 Feb 2022, Volker Wysk wrote:
>>> The type io.error is abstract. It looks like the only thing that can be done
>>> with it, is to create an error message. But I need to do something which
>>> depends on which error it is. So how to find this out...?
>> You can't using the interface currently exported by the io module.
>> The io.error type just holds an error message. The implementation of
>> the predicates in the io module internally uses a system_error type, but
>> as its names suggests it is system specific and in any case isn't
>> accesible to normal user code.
>> What is it that you are trying to do?
> I want to read the contents of a file, using open_input,
> read_file_as_string, close_input. In case the file doesn't exist, I want to
> return an empty string. So, in case of an error, I want to determine if it's
> because the file doesn't exist.
> It isn't a show stopper to me, I can return "" in case of any error, but it
> isn't optimal.
> users mailing list
> users at lists.mercurylang.org <mailto:users at lists.mercurylang.org>
> https://lists.mercurylang.org/listinfo/users <https://lists.mercurylang.org/listinfo/users>
-------------- next part --------------
An HTML attachment was scrubbed...
More information about the users