diff options
author | Hugo Hörnquist <hugo@lysator.liu.se> | 2020-06-29 17:52:20 +0200 |
---|---|---|
committer | Hugo Hörnquist <hugo@lysator.liu.se> | 2020-06-29 17:52:20 +0200 |
commit | 21ad7e33c5e4413fe7d1f3766dd471090a4f33df (patch) | |
tree | 3b7d5f9d73fc3d05f684b7c85d3d7383ba5d1782 | |
parent | Add /insert POST endpoint. (diff) | |
download | calp-21ad7e33c5e4413fe7d1f3766dd471090a4f33df.tar.gz calp-21ad7e33c5e4413fe7d1f3766dd471090a4f33df.tar.xz |
HTTP POST insertion works.
Diffstat (limited to '')
-rw-r--r-- | module/entry-points/server.scm | 9 | ||||
-rw-r--r-- | 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 <date>. (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))))))) |