<div dir="ltr"><div><div>Oh, I see!<br></div>Thanks a lot for the clarification (and thorough explanation).<br><br></div><div>I saw this line from the documentation</div><div><br>(apply throw args))))) ; and pass the error on up<br><br></div><div>and didn't take into account the signature of throw.<br><br></div><div>Thanks again!<br></div></div><br><div class="gmail_quote"><div dir="ltr" class="gmail_attr">On Sat, 18 Jul 2020 at 22:01, <<a href="mailto:bil@ccrma.stanford.edu">bil@ccrma.stanford.edu</a>> wrote:<br></div><blockquote class="gmail_quote" style="margin:0px 0px 0px 0.8ex;border-left:1px solid rgb(204,204,204);padding-left:1ex">throw is (throw tag . info), that is it takes its trailing args and puts <br>
them<br>
in a list. The first throw gets the args: 'some-error "..." 1. It <br>
passes<br>
these as: 'some-error ("..." 1) to the first error handler (that's why <br>
you<br>
can apply format to cadr -- cadr has been turned into a list). You <br>
throw<br>
that again using apply, so its args the second time are: some-error <br>
'("..." 1),<br>
(I'm trying to show that the second call is not like the first -- it has<br>
only one trailing arg, the list '("..." 1). Once again throw treats it <br>
as<br>
a rest arg, and puts it in a list, then the second error handler sees:<br>
some-error (("..." 1)). If you want to rethrow, the second throw needs<br>
to match the first one, use (apply throw (car args) (cadr args)).<br>
It might be better to use (lambda (type info) for the error handler,<br>
so you can say<br>
<br>
(catch #t<br>
(lambda ()<br>
(catch #t<br>
(lambda ()<br>
(throw 'some-error "::: ERROR ::: (~A)~%" 1))<br>
(lambda (type info)<br>
(apply format *stderr* info)<br>
(apply throw type info))))<br>
(lambda (type info)<br>
(apply format *stderr* info)<br>
))<br>
<br>
</blockquote></div>