summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorRicardo Wurmus <rekado@elephly.net>2020-04-05 18:27:25 +0200
committerRicardo Wurmus <rekado@elephly.net>2020-04-05 18:28:44 +0200
commitec255e3a7b4cedc2f3a6bac463732545fff0143f (patch)
tree39d9996c6736c01a1c5e143cee12dba218e8ca63
parent1591c2cc5af5d5b445b8039db83a124a83367c20 (diff)
controller: Remove render-with-error-handling.
-rw-r--r--mumi/web/controller.scm42
1 files changed, 16 insertions, 26 deletions
diff --git a/mumi/web/controller.scm b/mumi/web/controller.scm
index 11ad714..e420311 100644
--- a/mumi/web/controller.scm
+++ b/mumi/web/controller.scm
@@ -38,19 +38,6 @@
target
(list functions ...)))
-(define (render-with-error-handling page message)
- (apply render-html (page))
- ;; (catch #t
- ;; (lambda ()
- ;; (receive (sxml headers)
- ;; (pretty-print (page))
- ;; (render-html sxml headers)))
- ;; (lambda (key . args)
- ;; (format #t "ERROR: ~a ~a\n"
- ;; key args)
- ;; (render-html (error-page message))))
- )
-
(define %session-manager
(let ((key-file (string-append (%config 'key-dir) "signing-key")))
(if (file-exists? key-file)
@@ -87,21 +74,24 @@
;; Search for matching messages and return list of bug reports
;; that belong to them.
(else
- (render-with-error-handling
- (lambda ()
- (list-of-matching-bugs query
- (match (process-query query)
- ((#:terms terms
- #:sets s)
- (search-bugs (string-join terms)
- #:sets s)))))
- `(p "Could not search for " (strong ,query) "."))))))
+ (apply render-html
+ (list-of-matching-bugs query
+ (match (process-query query)
+ ((#:terms terms
+ #:sets s)
+ (search-bugs (string-join terms)
+ #:sets s)))))))))
((or ('GET "issue" (? string->number id))
('GET (? string->number id)))
- (render-with-error-handling
- (lambda () (or (and=> (fetch-bug id) issue-page)
- (unknown id)))
- `(p "Could not access issue #" (strong ,id) ".")))
+ (let ((message (match (uri-query (request-uri request))
+ ("comment-ok"
+ '(info . "Your comment has been submitted!"))
+ ("comment-error"
+ '(error . "There was an error submitting your comment!"))
+ (_ #f))))
+ (apply render-html (or (and=> (fetch-bug id)
+ issue-page)
+ (unknown id)))))
(('GET "issue" (? string->number id)
"attachment" (? string->number msg-num)
(? string->number path) ...)