new to the condition system



I'm trying to solve something akin to the following problem:

(defun test-fn ()
(handler-case
(random-fn)
(error (e)
(handler-fn))))

(defun random-fn ()
(loop as rand = (random 10)
do
(if (> rand 8)
(error "im too big ~d~%" rand)
(format t "no problem with me ~d~%" rand))))

(defun handler-fn ()
(format t "WHOOPS, found an error~%")
(test-fn))


Basically, I'd like to run test-fn, and every time random-fn returns
an error, I'd like to report the error and just restart from scratch
with test-fn. As written, these 3 functions very quickly return a
stack overflow, because we're just getting deeper and deeper into new
instances of test-fn. I'm obviously misusing the lisp conditional
system, but I'm a bit confused as to how to use it correctly. Any
help?

Thanks!

.