[PR #249] fix: handle DataNotLoadedError and session load failures gracefully (… #251

Open
opened 2026-05-07 00:19:24 +02:00 by BreizhHardware · 0 comments

📋 Pull Request Information

Original PR: https://github.com/IAmTomShaw/f1-race-replay/pull/249
Author: @nirvik34
Created: 3/11/2026
Status: 🔄 Open

Base: mainHead: fix/245-data-not-loaded-error


📝 Commits (5)

  • dd0ef90 fix: handle DataNotLoadedError and session load failures gracefully (#245)
  • 7b0af3e Merge branch 'IAmTomShaw:main' into fix/245-data-not-loaded-error
  • 542e9e5 fix(exceptions): refine session loading based on feedback
  • b053fb3 Refactor: Implement specific error handling & worker resilience
  • 2610ba8 Merge pull request #1 from IAmTomShaw/main

📊 Changes

2 files changed (+220 additions, -140 deletions)

View changed files

📝 main.py (+17 -7)
📝 src/f1_data.py (+203 -133)

📄 Description

Closes #245

Problem

When session data fails to load, the app crashes with a raw FastF1
traceback — confusing for users who don't know what
DataNotLoadedError means.

Changes

src/f1_data.py

  • Added robust error handling in load_session() helper
  • Catches DataNotLoadedError → session may not exist yet or still processing
  • Catches ConnectionError → tells user to check network
  • Catches metadata errors → prompts user to verify year/round inputs
  • App exits cleanly with friendly message instead of raw traceback

main.py

  • Added exit_on_failure=False flag for secondary qualifying data load
  • Race replay now continues even if qualifying/DRS zone data is unavailable

Before vs After

Before:

fastf1.exceptions.DataNotLoadedError: The data you are trying to access has not been loaded yet. See Session.load

After:

[ERROR] Session data could not be loaded.
This usually means:

  • The session hasn't happened yet
  • There's a network connectivity issue
  • The FastF1 cache is corrupted (try deleting .fastf1-cache/)

Testing

  • Valid session → loads normally
  • Invalid round number → friendly error shown
  • Missing qualifying data → race replay still continues

🔄 This issue represents a GitHub Pull Request. It cannot be merged through Gitea due to API limitations.

## 📋 Pull Request Information **Original PR:** https://github.com/IAmTomShaw/f1-race-replay/pull/249 **Author:** [@nirvik34](https://github.com/nirvik34) **Created:** 3/11/2026 **Status:** 🔄 Open **Base:** `main` ← **Head:** `fix/245-data-not-loaded-error` --- ### 📝 Commits (5) - [`dd0ef90`](https://github.com/IAmTomShaw/f1-race-replay/commit/dd0ef900fef67a8528183d3c3bcd939ef4d59e81) fix: handle DataNotLoadedError and session load failures gracefully (#245) - [`7b0af3e`](https://github.com/IAmTomShaw/f1-race-replay/commit/7b0af3eeebd64a4821ccbf04be21c86b23ca4892) Merge branch 'IAmTomShaw:main' into fix/245-data-not-loaded-error - [`542e9e5`](https://github.com/IAmTomShaw/f1-race-replay/commit/542e9e50efb84d83e9b59e2e01d04d65431b7fea) fix(exceptions): refine session loading based on feedback - [`b053fb3`](https://github.com/IAmTomShaw/f1-race-replay/commit/b053fb3bf6cfbf8012fe81ae5866c8e0b738e776) Refactor: Implement specific error handling & worker resilience - [`2610ba8`](https://github.com/IAmTomShaw/f1-race-replay/commit/2610ba828cd06f2df283a7a90a3d51d05ee584a5) Merge pull request #1 from IAmTomShaw/main ### 📊 Changes **2 files changed** (+220 additions, -140 deletions) <details> <summary>View changed files</summary> 📝 `main.py` (+17 -7) 📝 `src/f1_data.py` (+203 -133) </details> ### 📄 Description Closes #245 ## Problem When session data fails to load, the app crashes with a raw FastF1 traceback — confusing for users who don't know what `DataNotLoadedError` means. ## Changes ### `src/f1_data.py` - Added robust error handling in `load_session()` helper - Catches `DataNotLoadedError` → session may not exist yet or still processing - Catches `ConnectionError` → tells user to check network - Catches metadata errors → prompts user to verify year/round inputs - App exits cleanly with friendly message instead of raw traceback ### `main.py` - Added `exit_on_failure=False` flag for secondary qualifying data load - Race replay now continues even if qualifying/DRS zone data is unavailable ## Before vs After **Before:** > fastf1.exceptions.DataNotLoadedError: The data you are trying to access has not been loaded yet. See Session.load **After:** > [ERROR] Session data could not be loaded. > This usually means: > - The session hasn't happened yet > - There's a network connectivity issue > - The FastF1 cache is corrupted (try deleting .fastf1-cache/) ## Testing - Valid session → loads normally - Invalid round number → friendly error shown - Missing qualifying data → race replay still continues --- <sub>🔄 This issue represents a GitHub Pull Request. It cannot be merged through Gitea due to API limitations.</sub>
Sign in to join this conversation.
No milestone
No project
No assignees
1 participant
Notifications
Due date
The due date is invalid or out of range. Please use the format "yyyy-mm-dd".

No due date set.

Dependencies

No dependencies set.

Reference
starred/f1-race-replay#251
No description provided.