mIRC Homepage
Posted By: praetorian_ Ability to "throw" custom errors - 10/11/04 06:14 AM
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.
Posted By: tidy_trax Re: Ability to "throw" custom errors - 10/11/04 12:59 PM
Good idea, I think something like vb's "on error resume next" would be handy too (basically ignores all errors and continues execution, afaik).
Posted By: Debug Re: Ability to "throw" custom errors - 11/11/04 04:59 AM
Very good idea.
This would be nice
Posted By: bamaboy1217 Re: Ability to "throw" custom errors - 13/11/04 08:19 PM
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.
Posted By: Mpdreamz Re: Ability to "throw" custom errors - 11/07/08 04:22 PM
This would still be a nice feature wink
Posted By: foshizzle Re: Ability to "throw" custom errors - 11/07/08 05:14 PM
ya laugh
© mIRC Discussion Forums