Re: Try/Catch

new topic     » goto parent     » topic index » view thread      » older message » newer message
dcuny said...

This is not error handling.

if i <= length(s1) and j <= length(s1[i]) and j <= length(s2) and k <= length(s2[k]) then 
    s1[i][j] = s2[j][k] 
else 
    return false  -- oh dear, give up 
end if 

I get it. You are using "error" to mean "fatal error" whereas I am using the phrase "error code" to mean exactly that kind of long-winded and tedious code, which to be fair can itself be a source of unwanted errors. Wanting something neater is fine.

dcuny said...

"take action to recover from a exception, and continue normal execution"

Sure. But we ought to be cautious about over-selling this as some easy panacea. There will be cases where the long-winded and tedious approach turns out to be simpler, in the long run. We must still give a user an adequate warning about saving a possibly corrupt document even if it is annoying. Doing and saying nothing can be even more annoying than an abrupt crash. If there is a nasty bug that causes our program to quietly go bananas in the field, we still need to know about it. And so on.

dcuny said...
petelomax said...

cleanup(handle), or as below

I'm not sure what cleanup is defined as doing. Is this something you're proposing, or is already in Euphoria?

Oh, I just meant any-named user-defined routine with whatever parameters you might want or need containing common code factored out from the try and catch blocks.

dcuny said...

PS: I just use italics for emphasis, not irritation. smile

I thought you were having a dig at my use of italics when I first read that blink

Pete

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

Search



Quick Links

User menu

Not signed in.

Misc Menu