mIRC Home    About    Download    Register    News    Help

Print Thread
:error label not triggering #269601 14/11/21 03:32 PM
Joined: Jul 2006
Posts: 3,827
W
Wims Offline OP
Hoopy frood
OP Offline
Hoopy frood
W
Joined: Jul 2006
Posts: 3,827
Code
alias testerror {
  var %testerror 1
  :label
  echo -sg testerror %testerror
  inc %testerror 
  if (%testerror == 2) goto label


  :error
  if ($error) { reseterror | echo -sg testerror: $v1 | return }
  if ( { noop }
}
/testerror

The first part shows that a regular label can be found above the current point in script (backward jump), because we get two echos
The second part shows that the :error goto label feature does not work the same as regular label because the error is not caught, this is unexpected to me, is it normal?


Looking for a good help channel about mIRC? Check #mircscripting @ irc.swiftirc.net
Re: :error label not triggering [Re: Wims] #269606 15/11/21 11:25 AM
Joined: Dec 2002
Posts: 5,016
Khaled Offline
Hoopy frood
Offline
Hoopy frood
Joined: Dec 2002
Posts: 5,016
The goto and error label handling work in completely different ways.

The error handler is not jumping back in this case because the error label is before the command causing the error, so jumping back would likely result in an infinite loop.

That said, the error handler was implemented so long ago that the only way to be sure is to test it out. Either way, its behaviour will not be changed as this would cause backward compatibility issues.