GetLastError -- get error code for the last command
code = GetLastError()
This function queries Hollywood's internal error flag and returns the result. This flag is zero if the last command executed was successful. If the command failed, an error code which is not zero will be returned. This error code can than be used to query Hollywood for a name string that describes the error occurred. (use GetErrorName() then)

Important note: Hollywood's internal error flag will be reset to zero before a command is called. Therefore the error code you will get when you call GetLastError() is the error code of the function that was called before GetLastError().

Important note #2: This function is only useful if the automatical error handler is disabled. If it is enabled (which is the default), the error handler will break your script immediately when an error occurs. So your script will never reach a GetLastError() call if an error occurred and the automatic error handler is enabled. Therefore you will have to call ExitOnError() with False as the flag to disable Hollywood's error handler.

See Error codes for a list of all error codes defined by Hollywood.


non-zero if an error occurred, zero for success
ExitOnError(FALSE)       ; disable automatic error handler
LoadBGPic(1,"blablabla") ; this command will fail!
If code<>0
  SystemRequest("An error occurred!",err$,"OK")
The above code shows how to handle the error that LoadBGPic() will produce. It is important that there is no further command between the LoadBGPic() and the GetLastError(). If there would be another command, it would trash the error results of LoadBGPic().

Show TOC