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 ++++++++- module/srfi/srfi-41/util.scm | 2 +- 2 files changed, 9 insertions(+), 2 deletions(-) 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")))) diff --git a/module/srfi/srfi-41/util.scm b/module/srfi/srfi-41/util.scm index b1bc6f50..2da2b479 100644 --- a/module/srfi/srfi-41/util.scm +++ b/module/srfi/srfi-41/util.scm @@ -17,7 +17,7 @@ ;; If all streams where empty, end the output stream (if (null? streams) stream-null - (let* ((min other (find-min streams stream-car)) + (let* ((min other (find-extreme streams < stream-car)) (m ms (stream-car+cdr min))) (stream-cons m (interleave-streams < (cons ms other))))))) -- cgit v1.2.3