Legato
Legato

GoFiler Legato Script Reference

 

Legato v 1.6k

Application v 6.6a

  

 

Chapter FiveGeneral Functions (continued)

SetLastError Function

Overview

The SetLastError function allows a function to set the global error code and message for the script.

Syntax/Parameters

Syntax

int = SetLastError ( int code, [string message], [parameters ... ] );

Parameters

code

An integer or dword value to which the last error will be set. Do not set a value grater than 0xFFFFFFFF or an overflow error will occur.

message

An optional string to which the associated extended text message will be set. If omitted, the text portion is set to an empty string. If additional parameters are present, message is considered a formatted string. See Section 5.2 String Functions for more information on formatted strings.

parameters

Zero or more parameters to be formatted and inserted into message. If no parameters are supplied, message is simply passed through to the result string.

Return Value

Returns an int as ERROR_NONE or as ERROR_OVERLOW if the resulting string is too large. This function does not set the last error as a result of a processing problem. The last error and message are what is specified in the parameters.

Remarks

The SetLastError function provides an easy way to pass additional error information back to a caller. The values are subject to be reset anytime an SDK function is called.

For the message string, the formatted message cannot be more than 256 characters in size. If it is, the return value will contain an error code. It does not set that last error or message, since that will interrupt the setting of data. Any string over 256 characters will simply be truncated with the return code set to ERROR_OVERFLOW.

The last error code can also be access by other application functions such as menu and other hooks.

As mentioned above, each API call except for GetLastError, GetLastErrorMessage, IsError and IsNotError will reset the content of the last error buffer and code. Flow and language statements, such as return, if, while, etc. will not change the last error information. See Section 5.24 Last Error Functions at the start of this section for more information.

Related Functions

Platform Support

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

Legato IDE, Legato Basic