in-fin-neat / in-fin-neat-core

Personal Finances tool
1 stars 0 forks source link

Improve error message to report incorrect datetime format #18

Open leonardohscastilho opened 7 months ago

leonardohscastilho commented 7 months ago

When the report generation is executed with a wrong format command (date without time, for example), the report message is not clear to the end user. It's necessary to make explicit what is causing the error.

example of a command that could cause the issue: pipenv run generate_reports --start-time 2023-12-01 --end-time 2024-02-29 --user-config-file-path execution_config.yaml An exception happens in Python:

/filtering.py", line 12, in <listcomp>
    if entry_property(item) >= start and entry_property(item) <= end
       ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
TypeError: can't compare offset-naive and offset-aware datetimes

Acceptance Criteria: The reported message should make explicit the incorrect date time entry, for example: "Incorrect datetime format entry, please follow the ISO8601 datetime format"

Ref: https://docs.python.org/3/library/datetime.html