code = GetLastError()
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.
ExitOnError(FALSE) ; disable automatic error handler LoadBGPic(1,"blablabla") ; this command will fail! code=GetLastError() If code<>0 err$=GetErrorName(code) SystemRequest("An error occurred!",err$,"OK") End EndIfThe 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().