Follow bytes->string returning a Result

- A backup file that is not UTF-8 is an error that says so, through
  BackupRead, instead of an exception.
- bjomarks is at least 0.2.1, which follows the same change.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
This commit is contained in:
Linus Björnstam 2026-11-23 14:09:09 +01:00
parent e1ed969d30
commit 698d87ce31
3 changed files with 6 additions and 4 deletions

View file

@ -690,7 +690,9 @@
((Some f)
(def name (stored-file-name f))
(next (record-set m (note (str "Reading " name "…")))
(wrap (blocking (fun () (read-firefox-backup (bytes->string (stored-file-bytes f)))))
(wrap (blocking (fun () (match (bytes->string (stored-file-bytes f))
((Ok text) (read-firefox-backup text))
((Err e) (Err (str "the file is not UTF-8: " (decode-error-message e)))))))
(fun (r) (BackupRead name r)))))
(None (next m))))