chrisbillows / raindrop-todoist-syncer

Converts favourited Raindrops into tasks in Todoist.
2 stars 1 forks source link

Possible bug when last page of API results is full #59

Open chrisbillows opened 6 months ago

chrisbillows commented 6 months ago

There may be an error in the validation when the last page of raindrops is full i.e. contains 25 raindrops. In the below error it was expecting 0 but got 25. Presumably the range is running 0-24 rather than 1-25?

Resolved by adding another favourite thus pushing the results to a new page.

❯ python3 src/raindrop_todoist_syncer/main.py
2024-04-13 12:28:24 | INFO | Run started at 2024-04-13 12:28:24
2024-04-13 12:28:24 | INFO | Raindrop Client initalised
2024-04-13 12:28:24 | INFO | Access token is valid.
2024-04-13 12:28:24 | INFO | Get all raindrops called
2024-04-13 12:28:33 | ERROR | Last page results not expected length. Expected: 0, Got: 25
Traceback (most recent call last):
  File "raindrop-todoist-syncer/src/raindrop_todoist_syncer/main.py", line 48, in <module>
    main()
  File "raindrop-todoist-syncer/src/raindrop_todoist_syncer/main.py", line 35, in main
    all_raindrops = rc.get_all_raindrops()
  File "raindrop-todoist-syncer/src/raindrop_todoist_syncer/rd_client.py", line 128, in get_all_raindrops
    self._cumulative_rds_validator(cumulative_rds, current_rds, benchmark_count)
  File "/raindrop-todoist-syncer/src/raindrop_todoist_syncer/rd_client.py", line 336, in _cumulative_rds_validator
    raise ValueError(
ValueError: Last page results not expected length. Expected: 0, Got: 25

2024-04-13 12:28:33 | INFO | Run terminated at 2024-04-13 12:28:33 | Run time to failure 9.12 seconds