Skip to main content
Version: Next

Method called on error

Method called on error {( scope )} -> Function result

ParameterTypeDescription
scopeInteger🡒Scope of the error method
Function resultString🡐Name of method called on error

Description

The Method called on error command returns the name of the method installed by the ON ERR CALL command for the current process or the defined scope.

In the scope parameter, pass the execution context for which you want to get the name of the error handler method. You can use one of the following constants:

ConstantValueComment
ek errors from components2Errors that occurred in components
ek global1Errors that occurred in the global execution context of the project
ek local0Errors that occurred in the local execution context (default if scope parameter is omitted)

If no method has been installed for the scope, an empty string ("") is returned.

Example

This command is particularly useful in the context of components because it enables you to temporarily change and then restore the error-catching methods:

 $methCurrent:=Method called on error
 ON ERR CALL("NewMethod")
  // If the document cannot be opened, an error is generated
 $ref:=Open document("MyDocument")
  // Reinstallation of previous method
 ON ERR CALL($methCurrent)

See also

Error Handler
ON ERR CALL