[m-users.] io.error type
Volker Wysk
post at volker-wysk.de
Fri Feb 4 19:55:59 AEDT 2022
Am Freitag, dem 04.02.2022 um 09:27 +0100 schrieb Fabrice Nicol:
> Hi Volker
>
>
> > 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 toreturn an empty string. So, in case of an error, I want to determine if it'sbecause the file doesn't exist.
> > It isn't a show stopper to me, I can return "" in case of any error, but itisn't optimal.
> > Cheers,Volker
> >
>
> Why do you need to test according to io.error?
>
>
>
> io.error will only "materialize" logical failure. Which takes
> place further up in the tree.
I don't get it.
> So you just need to test against open_input out-mode argument
> values.
>
>
>
> Have you tried something along these lines?
I need to distinguish between "file does not exist" errors and other errors. I want the other errors stay errors, which will get reported later. Only "file does not exist" errors should be ignored.
Cheers, Volker
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.mercurylang.org/archives/users/attachments/20220204/e495dcec/attachment.html>
-------------- next part --------------
A non-text attachment was scrubbed...
Name: signature.asc
Type: application/pgp-signature
Size: 833 bytes
Desc: This is a digitally signed message part
URL: <http://lists.mercurylang.org/archives/users/attachments/20220204/e495dcec/attachment.sig>
More information about the users
mailing list