[Issue 12391] DirEntries throws in foreach

via Digitalmars-d-bugs digitalmars-d-bugs at puremagic.com
Wed Mar 23 11:23:20 PDT 2016


https://issues.dlang.org/show_bug.cgi?id=12391

--- Comment #6 from Jason Spashett <jason at spashett.com> ---
Could we not take something out of python's book (or some other language):

os.walk https://docs.python.org/2/library/os.html

(1) This [os.walk] gives an opportunity to have an error handler during the
walk. 
(2) alternatively a parameter that accepts a range that becomes a list of
errors.
(3) something else...

#2 doesn't seem that flexible looking at it, #1 would seem to be the way, as it
acts as a predicate in python too, if an exception is thrown from the error
handler the walk is stopped, otherwise it is not.

Often times I would like to ignore errors but log them. Other times better to
stop the traversal.

--


More information about the Digitalmars-d-bugs mailing list