From f8e32fd17a1fc3730dd3b6601133e65cd7f9df9d Mon Sep 17 00:00:00 2001 From: Arun Isaac Date: Tue, 15 Mar 2022 13:21:18 +0530 Subject: tissue: Raise exception on missing file when building website. * tissue/web.scm (build-website): Raise exception on missing file. --- tissue/web.scm | 22 ++++++++++++++-------- 1 file changed, 14 insertions(+), 8 deletions(-) diff --git a/tissue/web.scm b/tissue/web.scm index 715e5c7..2f8036c 100644 --- a/tissue/web.scm +++ b/tissue/web.scm @@ -205,14 +205,20 @@ per-tag issue listings are not generated." (string-suffix? ".skb" input-file)) (with-output-to-file output-file (cut evaluate-document - (call-with-input-file input-file - (cut evaluate-ast-from-port <> - #:reader ((reader:make (lookup-reader - (cond - ((string-suffix? ".gmi" input-file) - 'gemtext) - ((string-suffix? ".skb" input-file) - 'skribe))))))) + ;; Files may be renamed or deleted, but + ;; not committed. Therefore, raise an + ;; exception if the file does not exist. + (if (file-exists? input-file) + (call-with-input-file input-file + (cut evaluate-ast-from-port <> + #:reader ((reader:make (lookup-reader + (cond + ((string-suffix? ".gmi" input-file) + 'gemtext) + ((string-suffix? ".skb" input-file) + 'skribe))))))) + (raise (make-message-condition + (string-append "No such file or directory: " input-file)))) (find-engine 'html))) (copy-file input-file output-file)))))) rcons get-line port)) -- cgit v1.2.3