From 59728f72bd905ddc0e7ddc3e4fb1cb5fa1d48a2c Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Hugo=20H=C3=B6rnquist?= Date: Fri, 17 Apr 2020 22:07:48 +0200 Subject: Improve some errors. --- module/datetime/util.scm | 3 ++- module/vcomponent/recurrence/parse.scm | 9 ++++++++- 2 files changed, 10 insertions(+), 2 deletions(-) diff --git a/module/datetime/util.scm b/module/datetime/util.scm index 17d4f4da..da204f22 100644 --- a/module/datetime/util.scm +++ b/module/datetime/util.scm @@ -139,7 +139,8 @@ ;; NOTE this allows days larger than 7 (sunday if counting from monday). (let ((str (catch 'out-of-range (lambda () (locale-day (1+ (modulo week-day-number 7)))) - (lambda (oor str num) (scm-error 'out-of-range 'week-day-name "~a == (~a % 7) + 1" + (lambda (oor str num) (scm-error 'out-of-range 'week-day-name + "~a == (~a % 7) + 1" (list num week-day-number) (list week-day-number)))))) ;; I also know about the @var{locale-day-short} method, but I need ;; strings of length 2. diff --git a/module/vcomponent/recurrence/parse.scm b/module/vcomponent/recurrence/parse.scm index 66605c11..a2221660 100644 --- a/module/vcomponent/recurrence/parse.scm +++ b/module/vcomponent/recurrence/parse.scm @@ -52,7 +52,9 @@ ,@(map (match-lambda ((key guard '=> body ...) `((,key) (if (not ,guard) - (begin ,@else-clause) + (begin (warning (quote ,key) + (quote ,guard)) + ,@else-clause) (begin ,@body)))) ((key body ...) `((,key) (begin ,@body))) @@ -60,6 +62,11 @@ `(else ,@body))) cases)))) +(define (warning key guard ) + (display (format #f "Warning RRULE guard failed for key ~a~% guard: ~a~%" + key guard) + (current-error-port))) + ;; RFC 5545, Section 3.3.10. Recurrence Rule, states that the UNTIL value MUST have ;; the same type as the DTSTART of the event (date or datetime). I have seen events ;; in the wild which didn't follow this. I consider that an user error. -- cgit v1.2.3