(define main-loop (g-main-loop-new #f #f))
(a-sync (lambda (await resume)
	  (catch 'c-write-error
		 (lambda ()
		   (await-glib-put-string await resume port &quot;test&quot;))
		 (lambda (key . args)
		   (if (and (&gt;= (length args) 3)
			    (pair? (cddr args))
			    (pair? (caddr args))
			    (eqv? (caaddr args) EPIPE))
		       (begin
			 ... do something to cater for EPIPE ...)
		       (begin
			 ;; possibly rethrow the exception
			 (apply throw key args)))))
	  (g-main-loop-quit main-loop)))
(g