aboutsummaryrefslogtreecommitdiff
path: root/readers
diff options
context:
space:
mode:
authorMasaya Tojo <masaya@tojo.tokyo>2024-03-28 02:47:55 +0900
committerMasaya Tojo <masaya@tojo.tokyo>2024-03-28 02:47:55 +0900
commitc114d5cedab38a2f6683eabb7c98e9943eecf8bf (patch)
tree28b8a5ad822a335e4e12f21cccaf603882006341 /readers
parent5556605d5c37ed902b075447723b71bed847c195 (diff)
Add utils/date module.
Diffstat (limited to 'readers')
-rw-r--r--readers/article.rkt7
1 files changed, 4 insertions, 3 deletions
diff --git a/readers/article.rkt b/readers/article.rkt
index df5e8e8..c60de16 100644
--- a/readers/article.rkt
+++ b/readers/article.rkt
@@ -3,7 +3,8 @@
(provide read-article)
(require "../entities/article.rkt")
-(require (only-in typed/srfi/19 string->date))
+(require (only-in "../utils/date.rkt" string->date))
+
(require typed/json)
(require typed/syntax/readerr)
@@ -19,9 +20,9 @@
(define timestamp
(let ([timestamp (hash-ref jse 'timestamp (thunk (k "timestamp not found")))])
(unless (string? timestamp) (k "timestamp must be a string"))
- (with-handlers ([exn:fail? (const #f)])
+ (with-handlers ([exn:fail? (lambda (_e)
+ (k "timestamp must be a iso8600 string"))])
(string->date timestamp "~Y-~m-~dT~H:~M:~S~z"))))
- (unless (date? timestamp) (k "timestamp must be a iso8600 string"))
(define hash (hash-ref jse 'hash (thunk (k "hash not found"))))
(unless (string? hash) (k "hash must be a string"))