GetErrorSeverity Function

Action

Retrieves the severity level of an error.

An error code consits of the following three units:

  • severity

  • facility

  • error number

This function returns the severity part of it.

Include file

Kernel.bdh

Syntax

GetErrorSeverity( in nError: number ): number;

Return value

The severity level of an error.

Parameter Description
nError Specifies the Error code (usually retrieved with GetLastError()).

Example

dclfunc
  function PrintErrorStack
  var
    sError : string;
    sErrorNumber : string;
    sFacility : string;
    sSeverity : string;
    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
    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;

Output

Last Error: (Error Nr.: 5, Facility: 5, Severity: 3) = SYSTEM: 5 - The handle is incorrect.