mIRC Home    About    Download    Register    News    Help

Print Thread
Joined: Feb 2003
Posts: 32
P
Ameglian cow
OP Offline
Ameglian cow
P
Joined: Feb 2003
Posts: 32
I was just checking out the (relatively) new error handling stuff, and it occured to me that the ability to "throw" your own error messages (like the throw statement in Java and Visual Basic, et al.) would be handy.

Ideally a 'throw' command would fill $error with the specified text then behave the same way a normal error does.

Joined: Nov 2003
Posts: 2,327
T
Hoopy frood
Offline
Hoopy frood
T
Joined: Nov 2003
Posts: 2,327
Good idea, I think something like vb's "on error resume next" would be handy too (basically ignores all errors and continues execution, afaik).


New username: hixxy
Joined: Jul 2004
Posts: 150
D
Vogon poet
Offline
Vogon poet
D
Joined: Jul 2004
Posts: 150
Very good idea.
This would be nice

Joined: Jul 2003
Posts: 77
B
Babel fish
Offline
Babel fish
B
Joined: Jul 2003
Posts: 77
well theoritcly this can be emulated however... with return of a 0 or something

i think it would be nice though to do something like throw works like return yet if u do this

Code:
alias something {
  var %error = Some Error Msg
  throw %error
}
alias deal {
  if (!$something) echo -a ERROR: $error
  else echo -a OK: $result
}


The behavior would be as such that when returning via throw the alias is ALWAYS evaluated to false and $error holds the return, so no matter if u throw 0 or $true its always evaluated to false so u can know an error has occured and just incase its not a throw and its like a return 0 $result would also hold what $error had so i suppose $error is just there to make it look pretty but o well, the key is the evaluation to false.


hmmm signed by me
Joined: Apr 2004
Posts: 759
M
Hoopy frood
Offline
Hoopy frood
M
Joined: Apr 2004
Posts: 759
This would still be a nice feature wink


$maybe
Joined: Aug 2007
Posts: 334
Pan-dimensional mouse
Offline
Pan-dimensional mouse
Joined: Aug 2007
Posts: 334
ya laugh


This is not the signature you are looking for

Link Copied to Clipboard