got rid of stack trace and improved error messages in a minor way

svn: r2724
This commit is contained in:
Robby Findler 2006-04-20 14:51:48 +00:00
parent 122903d967
commit f5d5caddbf

View File

@ -69,6 +69,10 @@
(define init-page 0) (define init-page 0)
(define (die name . args)
(fprintf (current-error-port) "~a: ~a\n" name (apply format args))
(exit -1))
(define file-to-load (define file-to-load
(command-line (command-line
"slideshow" "slideshow"
@ -91,7 +95,7 @@
(integer? n) (integer? n)
(exact? n) (exact? n)
(positive? n)) (positive? n))
(error 'slideshow "argument to -t is not a positive exact integer: ~a" page)) (die 'slideshow "argument to -t is not a positive exact integer: ~a" page))
(set! init-page (sub1 n)))) (set! init-page (sub1 n))))
(("-q" "--quad") "show four slides at a time" (("-q" "--quad") "show four slides at a time"
(set! quad-view? #t) (set! quad-view? #t)
@ -104,9 +108,9 @@
(let ([nw (string->number w)] (let ([nw (string->number w)]
[nh (string->number h)]) [nh (string->number h)])
(unless (and nw (< 0 nw 10000)) (unless (and nw (< 0 nw 10000))
(error 'slideshow "bad width: ~e" w)) (die 'slideshow "bad width: ~e" w))
(unless (and nw (< 0 nh 10000)) (unless (and nw (< 0 nh 10000))
(error 'slideshow "bad height: ~e" h)) (die 'slideshow "bad height: ~e" h))
(set! actual-screen-w nw) (set! actual-screen-w nw)
(set! actual-screen-h nh))) (set! actual-screen-h nh)))
(("-a" "--squash") "scale to full window, even if not 4:3 aspect" (("-a" "--squash") "scale to full window, even if not 4:3 aspect"
@ -122,7 +126,7 @@
(integer? n) (integer? n)
(exact? n) (exact? n)
(positive? n)) (positive? n))
(error 'slideshow "argument to -m is not a positive exact integer: ~a" min)) (die 'slideshow "argument to -m is not a positive exact integer: ~a" min))
(set! talk-duration-minutes n))) (set! talk-duration-minutes n)))
(("-i" "--immediate") "no transitions" (("-i" "--immediate") "no transitions"
(set! use-transitions? #f)) (set! use-transitions? #f))
@ -143,8 +147,13 @@
[args slide-module-file [args slide-module-file
(cond (cond
[(null? slide-module-file) #f] [(null? slide-module-file) #f]
[(null? (cdr slide-module-file)) (car slide-module-file)] [(null? (cdr slide-module-file))
[else (error 'slideshow (let ([candidate (car slide-module-file)])
(unless (file-exists? candidate)
(die 'slideshow "expected a filename on the commandline, given: ~a"
candidate))
candidate)]
[else (die 'slideshow
"expects at most one module file, given ~a: ~s" "expects at most one module file, given ~a: ~s"
(length slide-module-file) (length slide-module-file)
slide-module-file)])])) slide-module-file)])]))