Skip to content

Fix: Add proper error handling for file read errors in load_file()#316

Closed
prjanitor wants to merge 1 commit intoTruncateGame:mainfrom
prjanitor:prjanitor/c385ca02a45643cbe736fbb88cc9a0e04357fa91
Closed

Fix: Add proper error handling for file read errors in load_file()#316
prjanitor wants to merge 1 commit intoTruncateGame:mainfrom
prjanitor:prjanitor/c385ca02a45643cbe736fbb88cc9a0e04357fa91

Conversation

@prjanitor
Copy link
Copy Markdown

Problem

The load_file() function in storage.rs was using .unwrap_or_default() to silently ignore file read errors. This could hide critical issues such as:

  • Missing seed_notes.yml file
  • Permission errors
  • Corrupted files

This made debugging difficult and could lead to unexpected behavior when the notes file was missing or inaccessible.

Solution

Changed .unwrap_or_default() to .expect("seed_notes.yml file must exist and be readable") to properly surface file read errors with a descriptive error message. This ensures that:

  1. Missing files are detected immediately
  2. Permission errors are reported
  3. Debugging is easier with clear error messages

Testing

The fix ensures that any file read error will now cause the program to panic with a clear error message, making it easier to identify and resolve issues with the seed notes file.


This PR was generated by PRJanitor — an automated tool that finds and fixes small bugs in open-source projects.

We respect your contribution guidelines — if your project doesn't accept bot PRs, we won't send more. You can also add a .github/prjanitor.yml file with enabled: false to opt out explicitly.

@gnesher
Copy link
Copy Markdown

gnesher commented Apr 4, 2026

Closing this PR -- after a closer review, we believe this change isn't correct. Apologies for the noise; we're still ironing out some kinks in our automated flow. Thanks for your patience!

@prjanitor prjanitor closed this Apr 4, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants