aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorHugo Hörnquist <hugo@lysator.liu.se>2022-03-17 22:14:54 +0100
committerHugo Hörnquist <hugo@lysator.liu.se>2022-03-28 14:17:47 +0200
commit2c75c571e0522dc067bcc536769539f0e9e22534 (patch)
tree7bbbe4316e76957d036635a220816e0d411038e0
parentAdd catch* (diff)
downloadcalp-2c75c571e0522dc067bcc536769539f0e9e22534.tar.gz
calp-2c75c571e0522dc067bcc536769539f0e9e22534.tar.xz
Use catch* where appropriate
-rw-r--r--module/calp/html/vcomponent.scm13
-rw-r--r--module/calp/server/routes.scm43
2 files changed, 30 insertions, 26 deletions
diff --git a/module/calp/html/vcomponent.scm b/module/calp/html/vcomponent.scm
index 9f7a30ba..c832ea93 100644
--- a/module/calp/html/vcomponent.scm
+++ b/module/calp/html/vcomponent.scm
@@ -39,10 +39,15 @@
;; NOTE this should have information about context (html/term/...)
;; And then be moved somewhere else.
(define-public (format-description ev str)
- (catch #t (lambda () ((get-config 'description-filter) ev str))
- (lambda (err . args)
- (warning "~a on formatting description, ~s" err args)
- str)))
+ (catch* (lambda () ((get-config 'description-filter) ev str))
+ (configuration-error
+ (lambda (key subr msg args data)
+ (format (current-error-port)
+ "Error retrieving configuration, ~?~%" msg args)))
+ (#t ; for errors when running the filter
+ (lambda (err . args)
+ (warning "~a on formatting description, ~s" err args)
+ str))))
;; used by search view
(define-public (compact-event-list list)
diff --git a/module/calp/server/routes.scm b/module/calp/server/routes.scm
index ee1f3cb2..7a5dd058 100644
--- a/module/calp/server/routes.scm
+++ b/module/calp/server/routes.scm
@@ -413,28 +413,27 @@
(define error #f)
(define search-result
- (catch #t
- (lambda ()
- (catch 'max-page
- ;; TODO Get-page only puts a time limiter per page, meaning that
- ;; if a user requests page 1000 the server is stuck trying to
- ;; find that page, which can take up to 1000 * timeslice = 500s = 8min+
- ;; A timeout here, and also an actual multithreaded server should
- ;; solve this.
- (lambda () (get-page paginator page))
- (lambda (err page-number)
- (define location
- (build-relative-ref
- path: r:path ; host: r:host port: r:port
- query: (encode-query-parameters
- `((p . ,page-number)
- (q . ,search-term)))))
- (return (build-response
- code: 307
- headers: `((location . ,location)))))))
- (lambda (err callee fmt arg data)
- (set! error
- (format #f "~?~%" fmt arg)))))
+ ;; TODO Get-page only puts a time limiter per page, meaning that
+ ;; if a user requests page 1000 the server is stuck trying to
+ ;; find that page, which can take up to 1000 * timeslice = 500s = 8min+
+ ;; A timeout here, and also an actual multithreaded server should
+ ;; solve this.
+ (catch* (lambda () (get-page paginator page))
+ (max-page
+ (lambda (err page-number)
+ (define location
+ (build-relative-ref
+ path: r:path ; host: r:host port: r:port
+ query: (encode-query-parameters
+ `((p . ,page-number)
+ (q . ,search-term)))))
+ (return (build-response
+ code: 307
+ headers: `((location . ,location))))))
+ (#t
+ (lambda (err callee fmt arg data)
+ (set! error
+ (format #f "~?~%" fmt arg))))))
(return '((content-type application/xhtml+xml))
(with-output-to-string