git.fiddlerwoaroof.com
Browse code

feat: WITH-SIMPLE-RESTART -> RESTART-CASE + error protocol

fiddlerwoaroof authored on 14/10/2022 03:24:44
Showing 1 changed files
... ...
@@ -83,6 +83,10 @@
83 83
                     :references (remove-if 'null references)))))
84 84
 
85 85
 
86
+(defvar *error-client* nil)
87
+(defgeneric record-error (client url)
88
+  (:method ((client null) feed-url)))
89
+
86 90
 (defun pull-and-store-feed (feed-url stream-provider &optional (feed-puller #'safe-pull-feed))
87 91
   (declare (optimize (debug 3)))
88 92
   (flet ((log-pull (stream)
... ...
@@ -98,7 +102,7 @@
98 102
                        (declare (ignore c))
99 103
                        (format *error-output* "~&SSL Error while pulling ~a~%"
100 104
                                feed-url))))
101
-      (with-simple-restart (skip-feed "Stop processing for ~a" feed-url)
105
+      (restart-case
102 106
         (let* ((feed (with-retry ("Pull feed again.")
103 107
                        (normalize-feed feed-url (log-pull t)))))
104 108
           (trivia:match (store feed stream-provider)
... ...
@@ -110,6 +114,10 @@
110 114
                                          (uiop:pathname-directory-pathname
111 115
                                           (merge-pathnames path
112 116
                                                            (stream-provider:root stream-provider))))))))))))
117
+        (skip-feed ()
118
+          :report (lambda (s)
119
+                    (format s "Stop processing for ~a" feed-url))
120
+          (record-error *error-client* feed-url))))))
113 121
 
114 122
 (defun archive-feeds (pull-time pull-directory index-stream)
115 123
   (prog1-bind (references (mapcar (op (pull-and-store-feed _ pull-directory))