aboutsummaryrefslogtreecommitdiff
path: root/module/datetime/zic.scm
diff options
context:
space:
mode:
Diffstat (limited to 'module/datetime/zic.scm')
-rw-r--r--module/datetime/zic.scm32
1 files changed, 24 insertions, 8 deletions
diff --git a/module/datetime/zic.scm b/module/datetime/zic.scm
index 0362ec99..e2600d4f 100644
--- a/module/datetime/zic.scm
+++ b/module/datetime/zic.scm
@@ -92,14 +92,14 @@
;; @end example
(define-public (get-zone zoneinfo name)
(or (hash-ref (zoneinfo-zones zoneinfo) name)
- (error "No zone ~a" name)))
+ (scm-error 'misc-error "get-zone" "No zone ~a" (list name) #f)))
;; @example
;; (get-rule zoneinfo 'EU)
;; @end example
(define-public (get-rule zoneinfo name)
(or (hashq-ref (zoneinfo-rules zoneinfo) name)
- (error "No rule ~a" name)))
+ (scm-error 'misc-error "get-rule" "No rule ~a" (list name) #f)))
@@ -119,7 +119,9 @@
[(string-prefix? name "October") 10]
[(string-prefix? name "November") 11]
[(string-prefix? name "December") 12]
- [else (error "Unknown month" name)]))
+ [else (scm-error 'misc-error "month-name->number"
+ "Unknown month ~s" (list name)
+ #f)]))
(define (string->weekday name)
@@ -131,7 +133,9 @@
[(string-prefix? name "Friday") fri]
[(string-prefix? name "Saturday") sat]
[(string-prefix? name "Sunday") sun]
- [else (error "Unknown week day" name)]))
+ [else (scm-error 'misc-error "string->weekday"
+ "Unknown week day ~s"
+ (list name) #f)]))
(define (parse-from str)
@@ -259,8 +263,10 @@
;; NOTE an earlier version of the code the parsers for those.
;; They were removed since they were unused, uneeded, and was
;; technical dept.
- (error (_ "Invalid key ~a. Note that leap seconds and
-expries rules aren't yet implemented.") type)]
+ (scm-error 'misc-error "parse-zic-file"
+ (_ "Invalid key ~s. Note that leap seconds and expries rules aren't yet implemented.")
+ (list type)
+ #f)]
))]))))))
@@ -357,7 +363,9 @@ expries rules aren't yet implemented.") type)]
until: (let ((to (rule-to rule)))
(case to
((maximum) #f)
- ((minimum) (error (_ "Check your input")))
+ ((minimum) (scm-error 'misc-error "rule->rrule"
+ (_ "Check your input")
+ #f #f))
((only)
(datetime
date: (date year: (rule-from rule) month: 1 day: 1)))
@@ -403,4 +411,12 @@ expries rules aren't yet implemented.") type)]
(warning (_ "%z not yet implemented"))
fmt-string]
- [else (error (_ "Invalid format char"))])))
+ [else (scm-error 'misc-error "zone-format"
+ ;; first slot is the errornous character,
+ ;; second is the whole string, third is the index
+ ;; of the faulty character.
+ (_ "Invalid format char ~s in ~s at position ~a")
+ (list (string-index fmt-string (1+ idx))
+ fmt-string
+ (1+ idx))
+ #f)])))