Re: exception handler

new topic     » goto parent     » topic index » view thread      » older message » newer message

Patrick Barnes wrote:

> If it's a handler, shouldn't it be able to continue (Definition)?
> Maybe it should have a different name if it can't resume.... crash
> cleanup?

My thoughts exactly. It isn't an exception handler if it can't handle 
exceptions. Maybe "airbag" would be more appropriate (when you crash, 
it does less damage;)

Anyway, as has been mentioned before, the type() routine could be 
extended in such a way as to allow handling many errors, simply by 
returning to the top of a program block marked by a 'catch' or 
'try' keyword.

type file(object x)
   if x =-1 then 
      msgbox("Cannot open file")
      return FALSE
   else return TRUE
 end type

 file fn
 object fname

 try
   puts(1,"Enter a file name here:")
   fname = gets(0)
   fn = open(fname,"r")
 end try


Irv

new topic     » goto parent     » topic index » view thread      » older message » newer message

Search



Quick Links

User menu

Not signed in.

Misc Menu