mathause / filefinder

find and parse file and folder names
MIT License
3 stars 1 forks source link

allow setting parse-error behaviour #60

Closed mathause closed 7 months ago

mathause commented 1 year ago

There are cases where files can be matched but not parsed. E.g.:

from filefinder import FileFinder
ff = FileFinder("", "{cat}_{cat}", test_paths=["a_b"])
ff.find_files()

This was always the case but might be worse after #57. We should allow setting the behaviour in this case. Such as:

ff.find_files(on_parse_error="raise")
ff.find_files(on_parse_error="warn")
ff.find_files(on_parse_error="skip")

https://github.com/mathause/filefinder/blob/32e1210064bdb30e70b6a3eb66b27bf52a7e8115/filefinder/_filefinder.py#L144-L145

mathause commented 8 months ago

Check the on_missing argument in https://github.com/mathause/filefinder/blob/main/filefinder/filters.py