errorCode

Type: Integer

The errorCode property of the Exception class contains a number that uniquely identifies an exception within a class of exceptions.

As Jade itself uses exception codes with lower numbers (that is, numbers less than 63,999), you should define error codes for your user-defined exceptions in the range 64,000 through Max_Integer (#7FFFFFFF, which equates to 2,147,483,647).

The following examples show the use of the errorCode property.

invalidObjectExceptionHandler(exObj: Exception; referencedObj: Object):
                              Integer updating, protected;
// -------------------------------------------------------------------------
// Exception handler to reset list box and collection for object not found
// and object deleted exceptions.  exObj is the exception object and
// referencedObj is the object to check against the error object.
// -------------------------------------------------------------------------
constants
    ObjectNotFound = 4;
    ObjectDeleted  = 1072;
begin
    if (exObj.errorCode = ObjectNotFound or exObj.errorCode = ObjectDeleted)
                and
        exObj.errorObject = referencedObj
    then
    // If exception is for the object we're checking for, reset ourselves
        abortTransaction;
        setCollection(null, false);
        return Ex_Abort_Action;
    endif;
    // Otherwise pass control to the next exception handler
    return Ex_Pass_Back;
end;

handleException(exObj: Exception): Integer;
constants
    StringTooLong = 1035;
begin
    if exObj.errorCode = StringTooLong then
        app.msgBox("The picture is too large:", "Error", 0);
        return Ex_Abort_Action;
    else
        return Ex_Pass_Back;                // default dialog
    endif;
end;

This property is displayed in the default exception dialog as error code. For details, see "Error Messages and System Messages", in the JadeMsgs.pdf file.