mIRC Home    About    Download    Register    News    Help

Print Thread
#141620 11/02/06 10:13 AM
Joined: Dec 2003
Posts: 61
A
Aeron Offline OP
Babel fish
OP Offline
Babel fish
A
Joined: Dec 2003
Posts: 61
I searched and there was no such other suggestion so:
Code:
try {
do()
}
catch {
fix($error)
}
finally {  [Optimal]
ok()
}
done()
 


Instead of:

Code:
do()
!goto finally
:error
fix($error)
!reseterror
!goto end
:finally
ok()
:end
done()


And ability to throw errors!
/throw Blah!

#141621 11/02/06 10:39 AM
Joined: Jan 2003
Posts: 2,523
Q
Hoopy frood
Offline
Hoopy frood
Q
Joined: Jan 2003
Posts: 2,523
I really doubt that a second way of catching errors will be implemented, you should be happy there's even one smile


/.timerQ 1 0 echo /.timerQ 1 0 $timer(Q).com
#141622 12/02/06 10:45 PM
Joined: Dec 2002
Posts: 2,962
S
Hoopy frood
Offline
Hoopy frood
S
Joined: Dec 2002
Posts: 2,962
True. It's a shame though because the try/except statement is a lot more structured and would make things simpler on a lot of situations.

Of course there's nothing technically preventing Khaled from supporting both methods. Hell, lets throw in the global on MERROR event that's been suggested too. I can see it now... anything inside a try is caught by except, otherwise it goes to the nearest :error, otherwise it propagates backwards through to any except or any :error until it's either reseterror'd by :error or until it reaches the top of the stack where it triggers any MERROR events, which may or may not halt it. Beautiful! Come on Khaled, you know you want to!



Experience has taught me I should state outright that I am in fact joking, otherwise someone will say "that's stupid", or worse, "that's a brilliant idea".


Spelling mistakes, grammatical errors, and stupid comments are intentional.
#141623 12/02/06 11:07 PM
Joined: Sep 2005
Posts: 2,881
H
Hoopy frood
Offline
Hoopy frood
H
Joined: Sep 2005
Posts: 2,881
I think a global on merror/mircerror event would be handy and it should work sort of the way you specified; mIRC will go to the :error label for the current scope, if there's a /reseterror it won't bother calling on merror, if there isn't, it will.


Link Copied to Clipboard