<div dir="ltr">This is not Drakma specific:<div><br></div><div><div>(defun try-request-from-multiple-urls (&rest urls)</div><div> (loop</div><div> (with-simple-restart (try-next "Try next URL")</div><div>
(handler-case</div><div> (let ((url (first urls)))</div><div> (format t "requesting ~A~%" url)</div><div> (return (drakma:http-request url)))</div><div> (usocket:timeout-error ()</div>
<div> (setf urls (rest urls))</div><div> (unless urls</div><div> (format t "no more urls, returning~%")</div><div> (return))</div><div> (format t "timeout, trying next url~%")</div>
<div> (invoke-restart 'try-next))))))</div></div><div><br></div><div style>Tune as desired. If you want to have the last timeout error percolate to the caller, you'll want handler-bind instead.</div><div style>
<br></div><div style>-Hans</div></div><div class="gmail_extra"><br><br><div class="gmail_quote">On Wed, Jun 12, 2013 at 9:42 PM, Patrick May <span dir="ltr"><<a href="mailto:patrick.may@mac.com" target="_blank">patrick.may@mac.com</a>></span> wrote:<br>
<blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex"> I have a list of IP addresses to poll and want to catch the USOCKET:TIMEOUT-ERROR from Drakma when a machine isn't available, log a message, and continue on mapping over the list. Does anyone have an example of how to do this?<br>
<br>
Thanks,<br>
<br>
Patrick<br>
<br>
<br>
</blockquote></div><br></div>