StrLastError


julius228

Recommended Posts

strLastError is a private variable and is only created when an error is caught by a try/catch block.  So:

// ? strLastError here will fail because it doesn't exist yet
try
   x = x + 1
catch()
   ? strLastError
endcatch
? strLastError

will work (if x doesn't exist), displaying the error twice because strLastError is created by the catch() statement, but then still exists after the endcatch.  It doesn't exist until an error occurs, so using it before the try, or really before the catch() will fail.  The last ? strLastError will fail if there is no error because strLastError is never created.

So really, as a rule, only use strLastError inside a catch()/endcatch block.

Link to comment
Share on other sites

  • 1 month later...

Archived

This topic is now archived and is closed to further replies.