Retrieves the first error from the error stack.
Certain conditions can be specified by the first two parameters for the retrieval of an error.
Kernel.bdh
GetFirstError( out nCustomSeverity : number optional, in nFacility : number optional, in nSeverityFlags : number optional, out sAddInformation : string optional, in nAddInfoSize : number optional, out nLine : number optional, out sFilename : string optional, in nFileNameSize : number optional ) : number;
error code. 0 if no error could be found.
| Parameter | Description | 
|---|---|
| nCustomSeverity | Receives the custom level of severity. If the custom level was not set, then the original severity of the error is returned. | 
| nFacility | If this parameter is > 0 then the facility of the returned error must match. | 
| nSeverity |  
                           				  Optional: Severity of the error that is raised if the verification fails. Can be one of the following values: 
                               
                           				  
                           
  |  
                        			 
                     
| sAddInformation | Specifies the buffer to receive additional information. | 
| nAddInfoSize | Specifies the length of the buffer, which receives the additional information. | 
| nLine | Receives the line number in the script where the error occured. | 
| sFilename | Specifies the buffer to receive the script file name. | 
| nFileNameSize | Specifies the length of the buffer, which receives the script file name. | 
dclfunc
  function PrintErrorStack
  var
    sError       : string;
    sErrorNumber : string;
    sFacility    : string;
    sSeverity    : string;
    nResult      : number;
    x : number;
    y : number;
  begin
    // get last error
    x := GetLastError();
    sErrorNumber := String(GetErrorCode(x));
    sFacility := String(GetErrorFacility(x));
    sSeverity := String(GetErrorSeverity(x));
    Print("Last Error: (Error Nr.: " + sErrorNumber + ", Facility: " + sFacility + ", Severity: " + sSeverity + ")");
    Print(" = " + GetErrorMsg(x));
    // get error stack
    WebVerifyTitle("Buy It");
    WebVerifyContent("Html", 3, "Right", WEB_VER_FLAG_CONTENT_SMALLER, SEVERITY_ERROR, true, nResult);
    WebPageUrl ("http://mycompany.com/frame/framea.html");
    x := GetFirstError(y, 0, 0, sError); 
    while x <> 0 do
      Print("Stack: " + String(x) + "; " + sError + "; " + String(y));
      Print(" = " + GetErrorMsg(x));
      x := GetNextError(y, 0, 0, sError);
    end;
  end PrintErrorStack;
               	 Last Error: (Error Nr.: 5, Facility: 5, Severity: 3) = SYSTEM: 5 - The handle is incorrect.