1
0
Fork 0

- improved error reporting in script 'generate-gemlog.lisp'.

This commit is contained in:
cage 2022-12-23 11:55:39 +01:00
parent 416d9356e4
commit 5d3f6b69fe
1 changed files with 17 additions and 11 deletions

View File

@ -137,29 +137,35 @@
(parse-gemini-file (fs:slurp-file a)) (parse-gemini-file (fs:slurp-file a))
(error (e) (error (e)
(notify (notify
"Unable to parse ~a: ~a" "Unable to parse ~a: ~a~%"
a e) a e)
nil))) nil)))
original-post-files)) original-post-files))
(all-meta (mapcar (lambda (a) (all-meta (mapcar (lambda (a file)
(handler-case (handler-case
(let ((meta (extract-meta a))) (let ((meta (extract-meta a)))
meta) (if meta
meta
(progn
(notify "Unable to find metadata for ~a~%"
file)
nil)))
(error (e) (error (e)
(notify (notify
"Unable to parse meta ~a: ~a" "Unable to parse metadata ~a: ~a~%"
a e) file e)
nil))) nil)))
parsed-posts))) parsed-posts
original-post-files)))
(loop for original-post-file in original-post-files (loop for original-post-file in original-post-files
for parsed-post in parsed-posts for parsed-post in parsed-posts
for meta in all-meta for meta in all-meta
when (and parsed-post meta) when (and parsed-post meta)
collect collect
(make-instance 'post (make-instance 'post
:original-file-path original-post-file :original-file-path original-post-file
:content (extract-non-meta parsed-post) :content (extract-non-meta parsed-post)
:meta meta)))) :meta meta))))
(defun post-topics (post) (defun post-topics (post)
(with-accessors ((meta meta)) post (with-accessors ((meta meta)) post