summaryrefslogtreecommitdiff
path: root/haunt/jakob/dynamic/captcha.scm
diff options
context:
space:
mode:
Diffstat (limited to 'haunt/jakob/dynamic/captcha.scm')
-rw-r--r--haunt/jakob/dynamic/captcha.scm11
1 files changed, 6 insertions, 5 deletions
diff --git a/haunt/jakob/dynamic/captcha.scm b/haunt/jakob/dynamic/captcha.scm
index 05426d1..b71bb23 100644
--- a/haunt/jakob/dynamic/captcha.scm
+++ b/haunt/jakob/dynamic/captcha.scm
@@ -26,9 +26,11 @@
#:use-module (ice-9 match)
#:use-module (ice-9 popen)
#:use-module (ice-9 threads)
+ #:use-module (jakob dynamic errors)
#:use-module (json)
#:use-module (rnrs bytevectors)
#:use-module ((rnrs base) #:select (assert))
+ #:use-module (rnrs conditions)
#:use-module (rnrs exceptions)
#:use-module (srfi-197)
#:use-module (srfi srfi-1)
@@ -168,7 +170,7 @@ internally-defined `time-to-live-seconds'."
('x 1)
(n (if (number? n)
0
- (error "Do not know how to differentiate.")))))
+ (error "Do not know how to differentiate." n)))))
(define (simplify-sexp sexp)
(match sexp
@@ -202,11 +204,11 @@ internally-defined `time-to-live-seconds'."
\\end{document}
" src)))
(unless (eqv? 0 (status:exit-val (system "pdflatex formula.tex")))
- (error "Cannot generate PDF"))
+ (error "Cannot generate PDF" #f))
(let* ((port (open-input-pipe "convert -density 300 formula.pdf -quality 90 png:-"))
(data (get-bytevector-all port)))
(unless (eqv? 0 (status:exit-val (close-pipe port)))
- (error "Cannot generate PNG"))
+ (error "Cannot generate PNG" #f))
data)))
(define (new-captcha!)
@@ -266,8 +268,7 @@ internally-defined `time-to-live-seconds'."
(define (validate-proof-of-work! prefix challenge-id)
(define zero-prefix (string-join (map (lambda (_) "0") (iota %hardness)) ""))
(when (member challenge-id (id-queue-free pow-challenge-id-queue))
- (raise (condition (&message
- (message "No such challenge ID")))))
+ (panic "No such challenge ID"))
(let* ((challenge (hash-ref pow-challenges challenge-id))
(hash-value (chain (list prefix challenge)
(string-concatenate _)