<html><head><meta http-equiv="Content-Type" content="text/html charset=utf-8"></head><body style="word-wrap: break-word; -webkit-nbsp-mode: space; -webkit-line-break: after-white-space;"><div>Sorry I missed this:</div><br><div><div>On Dec 8, 2014, at 6:45 PM, George Neuner <<a href="mailto:gneuner2@comcast.net">gneuner2@comcast.net</a>> wrote:</div><br class="Apple-interchange-newline"><blockquote type="cite">and code in the <body> needs to reference “db"</blockquote><br></div><div><div><font face="Courier New">(define (boiler-plate/f f)</font></div><div><font face="Courier New"> (define err-msg #f)</font></div><div><font face="Courier New"> (let/ec fail-network</font></div><div><font face="Courier New"> (with-handlers ([exn:fail:network?</font></div><div><font face="Courier New"> (lambda (e)</font></div><div><font face="Courier New"> (set! err-msg "database connection error")</font></div><div><font face="Courier New"> (fail-network err-msg))])</font></div><div><font face="Courier New"> (let ([db (connect-database)])</font></div><div><font face="Courier New"> (define (thunk)</font></div><div><font face="Courier New"> (f db))</font></div><div><font face="Courier New"> (let/ec fail-sql</font></div><div><font face="Courier New"> (with-handlers ([exn:fail:sql?</font></div><div><font face="Courier New"> (lambda (e)</font></div><div><font face="Courier New"> (let ([info (exn:fail:sql-info e)])</font></div><div><font face="Courier New"> (set! err-msg (cdr (assoc 'message info)))</font></div><div><font face="Courier New"> (fail-sql err-msg)))])</font></div><div><font face="Courier New"> (call-with-transaction db thunk #:isolation 'repeatable-read))</font></div><div><font face="Courier New"> (disconnect db)</font></div><div><font face="Courier New"> err-msg)))))</font></div><div><font face="Courier New"><br></font></div><div><font face="Courier New">(define-syntax-rule (boiler-plate db body ...)</font></div><div><font face="Courier New"> (boiler-plate/f (λ (db) body ...)))</font></div><div><font face="Courier New"><br></font></div><div><font face="Courier New">(let ()</font></div><div><font face="Courier New"> (define err-msg</font></div><div><font face="Courier New"> (boiler-plate</font></div><div><font face="Courier New"> db</font></div><div><font face="Courier New"> < body ... ></font></div><div><font face="Courier New"> ))</font></div><div><font face="Courier New"> ; err-msg needed here</font></div><div><font face="Courier New"> err-msg</font></div><div><font face="Courier New"> )</font></div><div><br></div></div></body></html>