SetFailedEx

Sets the error state and saves the data about the cause of the error in its own object instance.

METHOD SetFailedEx : I_AsyncServiceResultClass
VAR_INPUT
    stError : ST_ServiceErrorClass;
END_VAR

stError: Structured variable of type ST_ServiceErrorClass with the data on the cause of the error.

Return parameter: Own interface pointer of type I_AsyncServiceResultClass.

Example (extract)

METHOD MyServiceReq : BOOL
VAR_INPUT
    tTimeout : TIME;
END_VAR
VAR_OUTPUT
    ipResult : I_AsyncServiceResultClass := _fbResult;
END_VAR
IF ipResult.IsBusy() THEN(* service allready running => abort *)
    _state := 0;
    ipResult.SetAbortedEx( stReason := ERROR_INVALID_STATE );
    RETURN;
END_IF
IF tTimeout = T#0S THEN(* invalid parameter => failure *)
    ipResult.SetFailedEx( stError := ERROR_INVALID_VALUE );
    RETURN;
END_IF
ipResult.SetBusy();
_fbTimer( IN := FALSE, PT := tTimeout );
_state := 1;
THIS^();
MyServiceReq := TRUE;