Legato
Legato

GoFiler Legato Script Reference

 

Legato v 1.5d

Application v 5.25a

  

 

Chapter FiveGeneral Functions (continued)

GetLastError Function

Overview

The GetLastError function returns error information in the form of an integer error code. This information pertains to result of the previously called function. This function should be called immediately after the suspect function or after an IsError function.

Syntax/Parameters

Syntax

dword = GetLastError ( );

Parameters

(none)

Return Value

Returns an dword containing the error code supplied by the last function called. Error codes are either a simple code (ie., ERROR_FILE_NOT_FOUND (2)) or formatted error code with high bits such as ERROR_SOFT (0x80000000). Programmers should avoid using an integer data type to accept structured return codes since an int may sign extend resulting in incorrect comparisons.

Remarks

Most functions will populate the return value of the GetLastError function with error information. If the function returns an integer, the GetLastError function may duplicate its error return codes or supply additional error information. For functions whose return values are ambiguous, such as functions that return strings or functions that can return values such as -1 as both an error or as an allowable value, the GetLastError function must be used to identify an error. If the previous called function succeeded, the GetLastError function will return 0 or ERROR_NONE. The IsError function can be used to aid in easily identifying errors.

Within the script engine, the last error code is reset for the majority of Legato SDK functions. This means that the value returned by the GetLastError will most likely be reset by calling another function. Therefore the error value should be retrieved prior to calling any additional SDK functions. User-defined functions will not adjust the value of the last error. Error checking functions do not alter the content of the last error buffer. 

Main code filters are ERROR_MASK to get the type of errors and ERROR_CODE_MASK to get the related error code. For further information and formatted error code structure see Section 5.20 Error Processing and Codes.

For more information on error reporting, see Appendix A — Legato SDK Standard Definitions and Windows SDK System Error Codes.

Related Functions

Platform Support

Go13, Go16, GoFiler Complete, GoFiler Corporate, GoFiler, GoFiler Lite, GoXBRL

Legato IDE, Legato Basic