From dd15498fdd81f1b60dab8545453e9c512496c921 Mon Sep 17 00:00:00 2001 From: Robby Zambito Date: Thu, 16 Feb 2023 00:28:19 -0500 Subject: Raise an error when trying to serialize a json record and a key is missing. --- lib/zambyte/meta/json.sld | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) (limited to 'lib') diff --git a/lib/zambyte/meta/json.sld b/lib/zambyte/meta/json.sld index 6d18d88..f305319 100644 --- a/lib/zambyte/meta/json.sld +++ b/lib/zambyte/meta/json.sld @@ -76,7 +76,10 @@ (define (from-json-string str) (let ((json (string->json str))) - (constructor (json-ref json 'fields) ...))) + (parameterize ((json-key-not-found + (lambda () + (error "key not found in json string when converting to a record" 'from-json-string)))) + (constructor (json-ref json 'fields) ...)))) (handle-field-declarations field-declarations) ...)))) -- cgit