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 /module/entry-points | |
parent | Add /insert POST endpoint. (diff) | |
download | calp-21ad7e33c5e4413fe7d1f3766dd471090a4f33df.tar.gz calp-21ad7e33c5e4413fe7d1f3766dd471090a4f33df.tar.xz |
HTTP POST insertion works.
Diffstat (limited to 'module/entry-points')
-rw-r--r-- | module/entry-points/server.scm | 9 |
1 files changed, 8 insertions, 1 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")))) |