From 3b50061de125f328b79b632c6acdee4367a93594 Mon Sep 17 00:00:00 2001 From: Jay McCarthy Date: Thu, 12 Jan 2012 15:48:23 -0700 Subject: [PATCH] Throw an error when required fields are missing, rather than letting scribble error original commit: 2d0d4823a78147cc9fa4dfa85fc09a5a609ac2d1 --- collects/scriblib/bibtex.rkt | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/collects/scriblib/bibtex.rkt b/collects/scriblib/bibtex.rkt index ada9fe84..646e5ff0 100644 --- a/collects/scriblib/bibtex.rkt +++ b/collects/scriblib/bibtex.rkt @@ -171,6 +171,10 @@ (define the-raw (hash-ref raw key (λ () (error 'bibtex "Unknown citation ~e" key)))) (define (raw-attr a [def #f]) (hash-ref the-raw a def)) + (define (raw-attr* a) + (hash-ref the-raw a + (λ () (error 'bibtex "Key ~a is missing attribute ~a, has ~a" + key a the-raw)))) (match (raw-attr 'type) ["misc" (make-bib #:title (raw-attr "title") @@ -187,7 +191,7 @@ (make-bib #:title (raw-attr "title") #:author (parse-author (raw-attr "author")) #:date (raw-attr "year") - #:location (journal-location (raw-attr "journal") + #:location (journal-location (raw-attr* "journal") #:pages (parse-pages (raw-attr "pages")) #:number (raw-attr "number") #:volume (raw-attr "volume"))