Skip to content

Specific exception when reading an empty file #906

@jeanbournhonesqueMF

Description

@jeanbournhonesqueMF

Is your feature request related to a problem? Please describe.

Greetings,

My scripts creates products for Meteo-France forecasters and I read gribs with earthkit data.

Currently in the readers/init.py file, line 221, there is a
raise Exception(f"File is empty: '{path}'")

The only way to catch this exception is a except Exception as e, which is very bad to use.

It would be way better to have a specific error class.

Describe the solution you'd like

Create a class named FileIsEmptyError (name to be specified) to be able to catch theses problems.

Describe alternatives you've considered

No response

Additional context

I can create the PR if you want

Organisation

No response

Metadata

Metadata

Assignees

No one assigned

    Labels

    enhancementNew feature or request

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions