aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--module/calp/server/routes.scm16
1 files changed, 12 insertions, 4 deletions
diff --git a/module/calp/server/routes.scm b/module/calp/server/routes.scm
index 3fa9bc4d..843eb01c 100644
--- a/module/calp/server/routes.scm
+++ b/module/calp/server/routes.scm
@@ -433,10 +433,18 @@
[(js) "javascript"]
[else ext]))
- (return
- `((content-type ,(string->symbol (string-append "text/" mime))))
- (call-with-input-file (string-append "static/" * "." ext)
- read-string)))
+ (catch 'system-error
+ (lambda ()
+ (return
+ `((content-type ,(string->symbol (string-append "text/" mime))))
+ (call-with-input-file (string-append "static/" * "." ext)
+ read-string)))
+ (lambda (err proc fmt fmt-args data)
+ (warning (format #f "404|500: ~?" fmt fmt-args))
+ (if (and (not (null? data)) (= 2 (car data)))
+ (return (build-response code: 404)
+ (format #f "~?" fmt fmt-args))
+ (scm-error err proc fmt fmt-args data)))))
(GET "/static/:*{.*}" (*)
(return