$procerrorcontext

Return the location of the error specified by $procerror.

$procerrorcontext

Example: message "Error occurred at %%$procerrorcontext"

Return Values

Associative list that describes the context in which the error occurred.

Associative List Items Returned by $procerrorcontext

Item

Meaning
ERROR=ErrorValue The value of $procerror
MNEM=ErrorConstant The error constant associated with the current value of $procerror
DESCRIPTION=Text A brief description of the error
COMPONENT=CompName The name of the component in which the error occurred
PROCNAME=ModuleName The name of the ProcScript module in which the error occurred, that is, the name of the entry, the operation, global ProcScript, or the Ynnn number of the trigger (as shown in the script listing)
TRIGGER=TriggerName The trigger name abbreviation where the error occurred
LINE=LineNumber The line number (as shown in the component script listing) at which the error occurred. It does not match the line number seen in the code editor because blank lines and comments are not counted.
PROCLINE=ProcScript The ProcScript instruction where the error occurred.
ADDITIONAL=AssociativeList An associative list containing additional information. For details, see Additional Information
RETURN_VALUE=Value Negative value returned for the triggers preRequest, preActivate, and postRequest in server pages if the trigger is not exception-enabled.
CALLSTACK=List An associative list containing the call stack if an exception was thrown. For details, see Call Stack.

Use

Allowed in all component types.

Description

The $procerrorcontext function returns an associative list that describes the context of the last validation error that occurred.

In certain situations, $procerrorcontext offers additional information identified by the ID ADDITIONAL, which is itself an associative list.

If an error occurs when calling out to a web service, Uniface generates error -150 and provides details about the error in $procerrorcontext. Most of the information about the fault is provided under the ADDITIONAL ID.

If the module throws exceptions, the CALLSTACK item contains an associative list of context information for the calls that lead to the error location. Uncaught exceptions bubble up to the top of this call stack from the originating module.

To extract or format information from this function, you can use list handling ProcScript. For more information, see Parsing Nested Associative Lists

Example: Validating Keys and Error Handling

The following example uses the $curkey function to perform specific validation for each key and otherwise reports the error and context using $procerror and $procerrorcontext.

trigger validateKey

selectcase $curkey
   case 1 ;perform validation for the primary key
   ...
   case 2 ;perform validation for candidate key #2
...
   case 4 ;perform validation for candidate key #4
...
   elsecase
      message "Error %%$procerror occurred at %%$procerrorcontext"
      message "Context: %%$dataerrorcontext"
endselectcase
end; validateKey

Additional Information

Additional information is held under the ID ADDITIONAL, in an associative list. The contents vary depending on the command that resulted in the error:

ADDITIONAL List Items
Item Meaning
MODULENAME=ModuleName Name of the module upon which a call statement failed.
INSTANCENAME=InstanceName Name of the target instance on which a newinstance statement failed, or name of the instance containing the operation on which activate failed.
OPERATIONNAME=OperationName Name of the operation upon which an activate statement failed.
COMPONENTNAME=ComponentName Name of the target component upon which a newinstance statement failed.
COMPONENTID=ComponentID Component ID of a component upon which a newinstance statement failed due to a mismatch between unique IDs.
DESCRIPTORID=DescriptorID Descriptor ID of a component upon which a newinstance statement failed due to a mismatch between unique IDs.
Extra List Items under ADDITIONAL after Calls to SOAP Connector
Item Meaning
DRV=Connector Identifier of the connector in which the error occurred. For SOAP faults, it is always SOP.
LOCATION=SoapCallOutErrorLocation Stage at which the error occurred during SOAP call-out. For more information, see Information Returned for Web Services Call-Out Errors.

For each LOCATION, the error is further described using the items CODE, MESSAGE, ACTOR, and DETAIL

CODE=ErrorCode Short form the error description; mandatory.
MESSAGE=ErrorString Long form of the error description; mandatory.
ACTOR= If LOCATION=SOAPFAULT, the literal contents of the <faultactor> element , if available.

If LOCATION is CALLBACK_PRE or CALLBACK_POST, the component name and operation of the callback operation.

DETAIL= A string giving further application or processing details about the error, if available.

Extra List Items under ADDITIONAL after Calls to COM Call-out Connector

Item Meaning
DRV=Connector Identifier of the connector in which the error occurred. For COM call-out errors, it is always COM.
CLASS=

Type of error. For COM messages, this is always ICCDRV-COM-ERR Error with ICC system occurred. The error is further described using the items STATUS and MESSAGE

STATUS=ErrorCode ICC system error code.
MESSAGE=ErrorString Long form of the error description.

Call Stack

The information provided in the CALLSTACK, provides the PROCLINE, MODULE, and COMPONENT for each module in the call stack. Each item in the call stack is the calling parent of the item below it, so #1 represents the top of the call stack to which the except was thrown.

By default, when an uncaught exception occurs, Uniface provides the information from $procerrorcontext in a readable format, for example in a form (for Windows or character-based applications) or in a log file. For example:

ERROR=-10000
DESCRIPTION=Profile data not allowed to be null
COMPONENT=S_ORDERFRM
PROCNAME=DATAEXISTS
TRIGGER=DTLF
LINE=6
PROCLINE=
  throw -10000 , "Profile data not allowed to be null" , "PARAM_INDEX=%%VINDEX
  PARAM_NAME=%%PPROFILEDATA
  FIELD_NAME=%%VFIELDNAME"
ADDITIONAL=
  PARAM_INDEX=2
  PARAM_NAME=customer=alpha
  status=
  FIELD_NAME=status
CALLSTACK=
  #1=	
    PROCLINE=throw -10000 , "Profile data not allowed to be null" , "PARAM_INDEX=%%VINDEX
    PARAM_NAME=%%PPROFILEDATA
    FIELD_NAME=%%VFIELDNAME"
    MODULE=entry DATAEXISTS:6 of IDORDER.S_ORDER.ACMEORD
    COMPONENT=S_ORDERFRM
  #2=
    PROCLINE=call DATAEXISTS("S_ORDER","customer=alpha;status=")
    MODULE=trigger DETAIL:1 of BTN_RETRIEVE.S_ORDER.ACMEORD
    COMPONENT=S_ORDERFRM
History
Version Change
10.4.02.000 Includes CALLSTACK when exceptions are enabled.
10.3.02.058 Returns ICC system error details from COM connector when errors occur during COM call-out.
10.3.02.045 Added PROCLINE.

Compatibility: ADDITIONAL is now the ninth item in the list instead of the eighth item. Code that used the index position rather than the ID to extract the ADDITIONAL information must be updated.

9.5.01 Returns SOAP fault information from OSAP U2.0 connector when errors occur during web services call-out.

Related Topics