GetFunctionName Function

Action

Returns the name of the currently executing BDL function. If it is called within an error handler, it will return the name of the function where the error was raised.

Include file

Kernel.bdh

Syntax

GetFunctionName( ) : string;

Return value

The name of the function.

Example

dclevent
  handler ErrorHandler <EVENT_RAISE_ERROR>
  var
    sTrac : string;
    sFunc : string;
  begin
    sTrac := GetTransactionName();
    sFunc := GetFunctionName();
    write("error raised in transaction " + sTrac + " in function " + sFunc); 
    throw;
  end ErrorHandler;

dclfunc
  function f1
  begin
    // WebPageUrl will raise an error
    WebPageUrl("http://Does.not.exist");
  end f1;

dcltrans
  transaction TRaiseError
  var
    sBuf : string;
  begin
    f1();
  end TRaiseError;

Output

Error raised in transaction TRAISEERROR in function F1.