check that source exists (fixes #191)

candidate-v2.0
Matthew Butterick 6 years ago
parent 3706937dac
commit 1d4d220f58

@ -1 +1 @@
1545271092
1545591698

@ -84,6 +84,8 @@
source-path
maybe-output-path
maybe-template-path)
(unless (file-exists? source-path)
(raise-argument-error caller "existing source path" source-path))
(define output-path (or maybe-output-path (->output-path source-path)))
(unless output-path
(raise-argument-error caller "valid output path" output-path))
@ -124,6 +126,8 @@
(define+provide/contract (render source-path [maybe-template-path #f] [maybe-output-path #f])
((complete-path?) ((or/c #f complete-path?) (or/c #f complete-path?)) . ->* . (or/c string? bytes?))
(unless (file-exists? source-path)
(raise-argument-error 'render "existing source path" source-path))
(define output-path (or maybe-output-path (->output-path source-path)))
(unless output-path
(raise-argument-error 'render "valid output path" output-path))

Loading…
Cancel
Save