From: Austin Ziegler Date: 2002-12-06T22:15:15+09:00 Subject: Re: on error resume next On Fri, 6 Dec 2002 22:02:39 +0900, Shannon Fang wrote: Shannon -- I recommend that you start putting spaces around your symbols (e.g., f.class!=File COULD be interpreted as f.class! = File and not f.class != File). > conn = tcpserver.connect(remote) > if conn==nil then > #some problem with connection > exit > end conn = tcpserver.connect(remote) rescue conn = nil if conn.nil? then # some problem with connection exit end > f=File.open(testfile) > if f.class!=File then > #cannot open file > #do something with it > end f = File.open(testfile) rescue f = nil if f.nil? then # cannot open file # do something with it end This form of rescue won't work on all exception types, but it will catch a good majority of them. You could also make it so that the rescue calls a method and then checks $! (the global exception object) to determine the exact response, but that only hides your normal begin/rescue/end handling. -austin -- Austin Ziegler, austin@halostatue.ca on 2002.12.06 at 08.11.34