4D-SVG

SVG_Read_last_error

SVG_Read_last_error -> Function result

Parameter Type   Description
Function result Longint Number of last error

Description

The SVG_Read_last_error command returns the number of the last error that occurred during the execution of a 4D SVG component command and resets this error.

The error number returned can be specific to a component command or may be an error generated by 4D. The following errors are generated by the component:

8850 Insufficient number of parameters
8851 Invalid parameter type
8852 Invalid reference
8853 Incorrect value for attribute
8854 The element does not accept this command
8855 Invalid (ID not found in document) object name (symbol, marker, filter, etc.)
8856 DTD file not found
8857 Incorrect value for a parameter
8858 Unknown error

Example 1

Given the “SVG_error_mgmt” method of the example for the SVG_Set_error_handler command:

  //Installation of error-handling method
 $ Error_Method_Txt:=SVG_Set_error_handler("SVG_error_mgmt")
  //from now on it is the SVG_error_mgmt method that will be executed in the case of an error
 
  //Creation of new SVG document
 $SVG:=SVG_New(1200;900;"SVG Component Test";"";True)
 SVG_SET_VIEWBOX($SVG;0;0;1500;1000)
 
 If(SVG_Read_last_error=0)
 
    ...
 
 Else
  //The SVG_error_mgmt method has been called and has received the error number
 End if
 
  //Uninstalling of error-handling method
 SVG_Set_error_handler

Example 2

Given the following SVG_error_mgmt method:

 var $1 : Integer
 var $2 : Text
 
  //Keep the error and the context
 errorNumber:=$1
 commandName:=$2
 
  //Set the OK system variable to 0
 OK:=0

This method can be used as follows:

  // Installation of error-handling method
 $ Error_Method_Txt:=SVG_Set_error_handler("SVG_error_mgmt")
 
  // Creation of new SVG document
 $SVG:=SVG_New(1200;900;" SVG Component Test ";"";True)
 SVG_SET_VIEWBOX($SVG;0;0;1500;1000)
 If(OK=1)
 
    ...
 
 Else
    ALERT("Error No."+String(errorNumber)+" during execution of the command \""+commandName+"\"")
 End if
 
  // Uninstalling of error-handling method
 SVG_Set_error_handler

See also

SVG_Set_error_handler