From d1c8b93f7ba8376de9f1ddbf79c94537e394af52 Mon Sep 17 00:00:00 2001 From: Matthew Butterick Date: Fri, 4 Jan 2019 18:49:54 -0800 Subject: [PATCH] error msg for no pages --- pitfall/pitfall/page.rkt | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/pitfall/pitfall/page.rkt b/pitfall/pitfall/page.rkt index c18918d9..bd61be2d 100644 --- a/pitfall/pitfall/page.rkt +++ b/pitfall/pitfall/page.rkt @@ -8,7 +8,10 @@ (provide (all-defined-out)) -(define (current-page doc) (car (pdf-pages doc))) +(define (current-page doc) + (match (pdf-pages doc) + [(? pair? ps) (car ps)] + [_ (raise-argument-error 'current-page "no pages in pdf" doc)])) (define (add-content doc data) (page-write (current-page doc) data))