In cases like this I usually just add some messgeboxes to the code to find the point where things go wrong, but in this case
Nsisdbg plug-in is probably much better choice.
With Nsisdbg plug-in use the nsisdbg::sendtolog call to track the progress of your script.
Edit: I just realized that the Nsisdbg plug-in download link is is dead. I uploaded the
plug-in on my site.