Handle all bank loading gracefully.

This commit is contained in:
Dominik Pantůček 2023-04-04 22:34:41 +02:00
parent cc4cfccae1
commit e25a75ab27
5 changed files with 51 additions and 29 deletions

View file

@ -38,6 +38,7 @@
(chicken keyword)
(chicken io)
(chicken irregex)
(chicken condition)
testing
progress)
@ -103,8 +104,14 @@
;; Loads given CSV file and parses its lines into lists
(define (csv-parse fn . args)
(let ((lines (read-lines (open-input-file fn))))
(apply csv-parse-lines lines args)))
(call/cc
(lambda (ret)
(with-exception-handler
(lambda (ex)
(ret #f))
(lambda ()
(let ((lines (read-lines (open-input-file fn))))
(apply csv-parse-lines lines args)))))))
;; Splits CSV into header and body based on the first empty row.
(define (csv-split-header csv)