Archive: URGENT!! bug with IfErrors, or i need to sleep. ;)


URGENT!! bug with IfErrors, or i need to sleep. ;)
  OK, according to the docs for IfErrors:

Checks and clears the error flag
As far as I can tell, it does not clear the error flag. :( Here's a small script that demonstrates this:
Name "iferrors bug?"

>OutFile "iferrors.exe"
>ShowInstDetails nevershow
AutoCloseWindow true

Section "one"
ClearErrors
ReadRegStr$1 HKCR "software\microsoft" shit
IfErrors 0 NoError
#ClearErrors ;HAVE TO CLEAR ERROR FLAG, OTHERWISE IT PERSISTS!
MessageBox MB_OK "could not read from HKCR\software\microsoft\shit"
Goto ErrorYay
NoError:
MessageBox MB_OK "read '$1' from HKCR\software\microsoft\shit"
ErrorYay:
>SectionEnd

Section "two"
IfErrors 0 NoError
MessageBox MB_OK "error in section two!!"
Goto ErrorYay
NoError:
MessageBox MB_OK "no errors in section two"
ErrorYay:
>SectionEnd
>
If ClearErrors is used to manually clear the error flag, that seems to work.

I hope I'm not just confused/hallucinating. :(

Somebody please confirm this is a bug or let me know where i've gone wrong. :igor: i'm using the latest development snapshot.

thanks

Salaam/Peace

I've tested this with a different script, but it gives the same result.


ReadRegStr $1 HKCR "software\\microsoft" shit

IfErrors 0 Not
IfErrors 0 Not
MessageBox MB_OK "Error!"
>Not:
Or Documentation Fix or Command Fix here.

hi deguix,

thx for checking out my problem. :)

the script you posted shows the problem with greater clarity, thank you. :)

actually i started with a small script like yours, but then i was wondering if there was a scoping issue so that at least a different section would have a cleared error flag... i was quite surprised when i saw the error flag persisted across sections after using 'IfErrors'.

lol - i'm not sure how much sense that last paragraph made, but it makes sense to me. ;)

Salaam/Peace.


Well, I don't know if it's a bug in the Docs or in NSIS, but I can tell you, psyke, that you are NOT hallucinating, confused or tired. Be happy ;)!


thanks virtlink. :)

i'm feeling less confused and tired now. ;)


Fixed in latest CVS version (clears the error flag again).


thanks, kichik, great job as usual. :)

Salaam/Peace.