mIRC Homepage

$hfind/$findfile/... not giving line # on error

Posted By: Wims

$hfind/$findfile/... not giving line # on error - 06/01/19 04:44 AM

When an error is generated from the command parameter of these ($finddir not tested but most likely included), the line number and script file for the error is not provided:

$hfind(1,*,0,w,if () ) or $findfile(.,*,0,if ($inrect(1,2,3)) noop )

Posted By: Khaled

Re: $hfind/$findfile/... not giving line # on error - 06/01/19 01:27 PM

Thanks for your bug report. I have not been able to reproduce this issue yet. If I place your $findfile() example in an alias in a script and call the alias from the editbox, it reports an error with the script name and line number.
Posted By: Wims

Re: $hfind/$findfile/... not giving line # on error - 06/01/19 05:22 PM

It may be related to my usage of bracket, I thought any kind of script error would do it.


The functionnal line of code:
Code:
noop $hfind(rr,i*,0,w,if ($inrect($mouse.x,$mouse.y, [[ $hget(rr,$1) ]] )) noop)


What triggers the issue (invalid parameters: $inrect) is:
Code:
noop $hfind(rr,i*,0,w,if ($inrect($mouse.x,$mouse.y,[ $hget(rr,$1) ])) noop)

So:
Code:
alias testerror {
  hadd -m rr i1 0 , 0 , 0 , 0
  noop $hfind(rr,i*,0,w,if ($inrect(0,0,[ $hget(rr,$1) ])) noop)
  :error
  hfree rr
  if ($error) {
   reseterror
   echo 4 -s from /testerror:  $v1
  }
}
This reproduce the issue for me, I'm on 7.53 and not 7.54 for some reasons.
Posted By: maroon

Re: $hfind/$findfile/... not giving line # on error - 07/01/19 02:13 AM

It's happening in 7.54 also. It happens for $hfind but I can't make it happen for $findfile or $finddir. When this glitch happens, it's falling through to the next line with $error defined without mentioning a line number, instead of jumping to the :error label.

Code:
alias testerror {
  echo 5 -a beginning value of $ $+ error is: $error
  ; echo -a $null 
  ; noop  $findfile(.,*,0,1,if $false noop)
  ; noop  $finddir(.,*,0,1,if $false noop)
  noop     $hfind(rr,i*,0,w,if $false noop)
  echo 6 -a falling thru. this will not contain a line number: $error
  :error
  echo 3 -a entered :error at line $scriptline with $ $+ error set to: $error
  if ($error) {
    reseterror
    echo 4 -s from /testerror:  $v1
  }
}
Posted By: maroon

Re: $hfind/$findfile/... not giving line # on error - 07/01/19 03:10 PM

Sorry. I still had the hashtable in memory from the prior alias, and shouldn't have taken the line

hadd -m rr i1 0 , 0 , 0 , 0

... out of the alias. One you add this line to the beginning of my version of the alias, the error without the line number happens again. The trigger was an error within the $hfind command, not with $inrect specifically.
Posted By: Wims

Re: $hfind/$findfile/... not giving line # on error - 12/01/19 11:17 AM

I mistested using the editbox for $findfile, that's why it didn't have line numbers etc. But you found a different issue here, it should not call the '/echo 6 -a' line after the error. Though, this may be the same issue internally.

Khaled: Can you reproduce?
Posted By: Khaled

Re: $hfind/$findfile/... not giving line # on error - 14/01/19 09:59 AM

Thanks, I was able to reproduce this issue. In this case, $hfind() was coded so that it would not halt a script if there was an error in the alias call. I cannot see how this would be useful, so I am going to assume it is a bug. This has been fixed for the next version.
© 2019 mIRC Discussion Forums