From 21ad7e33c5e4413fe7d1f3766dd471090a4f33df Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Hugo=20H=C3=B6rnquist?= Date: Mon, 29 Jun 2020 17:52:20 +0200 Subject: HTTP POST insertion works. --- module/entry-points/server.scm | 9 ++++++++- 1 file changed, 8 insertions(+), 1 deletion(-) (limited to 'module/entry-points/server.scm') diff --git a/module/entry-points/server.scm b/module/entry-points/server.scm index 6a96e90b..3356a142 100644 --- a/module/entry-points/server.scm +++ b/module/entry-points/server.scm @@ -3,6 +3,7 @@ :use-module (util app) :use-module (util config) :use-module (util options) + :use-module (util exceptions) :use-module (srfi srfi-1) @@ -105,6 +106,7 @@ intervaltype: 'month )))))) + ;; TODO this fails when dtstart is . (POST "/insert" (cal data) (unless (and cal data) @@ -137,7 +139,12 @@ (return (build-response code: 400) "Object not a VEVENT\r\n")) - (calendar-import calendar event) + (parameterize ((warnings-are-errors #t)) + (catch 'warning + (lambda () (calendar-import calendar event)) + (lambda (err fmt args) + (return (build-response code: 400) + (format #f "~?~%" fmt args))))) (return '((content-type text/plain)) "Event inserted\r\n")))) -- cgit v1.2.3