From c114d5cedab38a2f6683eabb7c98e9943eecf8bf Mon Sep 17 00:00:00 2001 From: Masaya Tojo Date: Thu, 28 Mar 2024 02:47:55 +0900 Subject: Add utils/date module. --- readers/article.rkt | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-) (limited to 'readers/article.rkt') 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")) -- cgit v1.2.3