Skip to content

Descriptive FileNotFoundError for Harvester.add_file #484

@MauritsDescamps

Description

@MauritsDescamps

The add_file method of Harvester, does not raise a descriptive error when the file does not exist.

To Reproduce

from harvesters.core import Harvester
h = Harvester()
h.add_file("nonexistent_path")

Output

2025-03-04 16:41:51,399 :: harvesters.core :: ERROR :: attempted to add but doesn't exist: nonexistent_path
Traceback (most recent call last):
  File "/../test.py", line 4, in <module>
    h.add_file("nonexistent_path", check_existence=True)
  File "/../harvesters/core.py", line 3265, in add_file
    raise FileNotFoundError
FileNotFoundError

Expected Behavior

2025-03-04 16:41:51,399 :: harvesters.core :: ERROR :: attempted to add but doesn't exist: nonexistent_path
Traceback (most recent call last):
  File "/../test.py", line 4, in <module>
    h.add_file("nonexistent_path", check_existence=True)
  File "/../harvesters/core.py", line 3265, in add_file
    raise FileNotFoundError
FileNotFoundError: nonexistent_path

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions