[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: Get-pure-port aborts giving error 10054



Jens Axel Søgaard writes:

> how can I make sure my program doesn't abort abruptly?

I have a related problem, today. Sometimes, Matlab - which I call from
MzScheme - fails to write intermediate computational data to a file.
The file is not absolutely necessary but the occuring error blocked
all further computation which is very bad.
What I will do is using with-handlers.


The syntax is like:

(with-handlers  ((exception-x? handler-x)
		   (exception-y? handler-y) 
                  ...)
     expression 
     ...)


A little example:

(do ((i -5 (+ 1 i)))
    ((< 5 i) 'The-End)
  (with-handlers (((lambda (exn) #t) (lambda (exn) 
				             (write "Error. Going on.")
				             (newline))))
    (write (/ 5 i))
    (newline)))


Sebastian