4. OnFault in a main as well as separated Sequences - processing error from OnFault

What will happen if we get an error in the OnFault part?
That can also happen. If we presume that mail is sent through OnFault processing, and mail server is not reachable in this moment, when we processing our OnFault part.
We can extend a previos process (from point 2), with one more sequence that we will name a mainSequence. In the case error happens in any of OnFaults, from firstSequence or secondSequence, then process will continue with OnFault connected to a main Sequence. If it fails as well, there is no way to finish process correctly, and it will stay in e.g. Halted state. You cannot be 100% sure that your process will always handle all possible errors.

Bpml code:
<process name="default">
<sequence name="mainSequence">
<sequence name="firstSequence">
<assign name="Assign" to="firstSequenceVar_1">1_1</assign>
<operation name="File System Adapter">
<participant name="FS_InstallValidation"/>
<output message="FileSystemInputMessage">
<assign to="." from="*"></assign>
<assign to="Action">FS_COLLECT</assign>
<assign to="filter">*.txt</assign>
<assign to="deleteAfterCollect">false</assign>
</output>
<input message="inmsg">
<assign to="." from="*"></assign>
</input>
</operation>
<assign name="Assign" to="firstSequenceVar_2">1_2</assign>
<onFault code="No files to collect">
<sequence name="Sequence Start">
<assign name="Assign" to="ERROR_SEQ1">There is no files to collect from collection Folder!</assign>
</sequence>
</onFault>
<onFault>
<sequence name="Sequence Start">
<operation name="Business Process Metadata">
<participant name="BPMetaDataInfoService"/>
<output message="BPMetaDataServiceTypeInputMessage">
<assign to="." from="*"></assign>
<assign to="TRACE">TRUE</assign>
</output>
<input message="inmsg">
<assign to="." from="*"></assign>
</input>
</operation>
<operation name="XSLT Service">
<participant name="XSLTService"/>
<output message="XSLTServiceTypeInputMessage">
<assign to="." from="*"></assign>
<assign to="xslt_name">TEST_error</assign>
<assign to="xml_input_from">ProcData</assign>
<assign to="input_pd_xpath">/</assign>
</output>
<input message="inmsg">
<assign to="." from="*"></assign>
</input>
</operation>
<operation name="Mail Mime Service">
<participant name="MailMimeService"/>
<output message="MailMimeServiceInputMessage">
<assign to="." from="*"></assign>
<assign to="mail-mime-subject">GIS error in sequence 1</assign>
<assign to="mail-mime-sender">GIS_admin</assign>
<assign to="mail-mime-operation">build</assign>
<assign to="mail-mime-recipient">mirjana.vojvodic@tis.hr</assign>
</output>
<input message="inmsg">
<assign to="." from="*"></assign>
</input>
</operation>
<operation name="SMTP Send Adapter">
<participant name="SMTP_SEND_ADAPTER"/>
<output message="SMTP_SEND_ADAPTERInputMessage">
<assign to="." from="*"></assign>
<assign to="xport-smtp-mailto">mirjana.vojvodic@tis.hr</assign>
<assign to="xport-smtp-mailhost">192.168.100.128</assign>
<assign to="b2b-raw-message">true</assign>
<assign to="xport-smtp-mailport">25</assign>
</output>
<input message="inmsg">
<assign to="." from="*"></assign>
</input>
</operation>
</sequence>
</onFault>
</sequence>
<sequence name="secondSequence">
<assign name="Assign" to="secondSequenceVar_1">2_1</assign>
<operation name="XML Validation Service">
<participant name="XMLValidator_WellFormed"/>
<output message="XMLValidatorInputMessage">
<assign to="." from="*"></assign>
</output>
<input message="inmsg">
<assign to="." from="*"></assign>
</input>
</operation>
<assign name="Assign" to="secondSequenceVar_2">2_2</assign>
<onFault code="schema:validationerr">
<sequence>
<assign name="Assign" to="ERROR_SEQ2">XML validation error, Primary Document is not well-formed XML</assign>
<operation name="Business Process Exception">
<participant name="BPExceptionService"/>
<output message="BPExceptionServiceTypeInputMessage">
<assign to="." from="*"></assign>
<assign to="exceptionCode">33</assign>
</output>
<input message="inmsg">
<assign to="." from="*"></assign>
</input>
</operation>
</sequence>
</onFault>
<onFault>
<sequence name="Sequence Start">
<operation name="Business Process Metadata">
<participant name="BPMetaDataInfoService"/>
<output message="BPMetaDataServiceTypeInputMessage">
<assign to="." from="*"></assign>
<assign to="TRACE">TRUE</assign>
</output>
<input message="inmsg">
<assign to="." from="*"></assign>
</input>
</operation>
<operation name="XSLT Service">
<participant name="XSLTService"/>
<output message="XSLTServiceTypeInputMessage">
<assign to="." from="*"></assign>
<assign to="xslt_name">TEST_error</assign>
<assign to="xml_input_from">ProcData</assign>
<assign to="input_pd_xpath">/</assign>
</output>
<input message="inmsg">
<assign to="." from="*"></assign>
</input>
</operation>
<operation name="Mail Mime Service">
<participant name="MailMimeService"/>
<output message="MailMimeServiceInputMessage">
<assign to="." from="*"></assign>
<assign to="mail-mime-subject">GIS error in sequence 2</assign>
<assign to="mail-mime-sender">GIS_admin</assign>
<assign to="mail-mime-operation">build</assign>
<assign to="mail-mime-recipient">mirjana.vojvodic@tis.hr</assign>
</output>
<input message="inmsg">
<assign to="." from="*"></assign>
</input>
</operation>
<operation name="SMTP Send Adapter">
<participant name="SMTP_SEND_ADAPTER"/>
<output message="SMTP_SEND_ADAPTERInputMessage">
<assign to="." from="*"></assign>
<assign to="xport-smtp-mailto">mirjana.vojvodic@tis.hr</assign>
<assign to="xport-smtp-mailhost">192.168.100.128</assign>
<assign to="b2b-raw-message">true</assign>
<assign to="xport-smtp-mailport">25</assign>
</output>
<input message="inmsg">
<assign to="." from="*"></assign>
</input>
</operation>
</sequence>
</onFault>
</sequence>
<onFault>
<sequence>
<assign name="Assign" to="ERROR_MAIN">ERROR FROM A MAIN SEQUENCE</assign>
</sequence>
</onFault>
</sequence>
</process>
If we force the error (33) in OnFault group in the second sequence, you can see that in the following part of code pasted above:
<onFault code="schema:validationerr">
<sequence>
<assign name="Assign" to="ERROR_SEQ2">XML validation error, Primary Document is not well-formed XML</assign>
<operation name="Business Process Exception">
<participant name="BPExceptionService"/>
<output message="BPExceptionServiceTypeInputMessage">
<assign to="." from="*"></assign>
<assign to="exceptionCode">33</assign>
</output>
<input message="inmsg">
<assign to="." from="*"></assign>
</input>
</operation>
</sequence>
</onFault>
... second sequence will fail with an error, its OnFault will also fail with an error, but the OnFault connected to the mainSequence can handle that error.
Process monitor, process flow:
We can see 3 errors, first from the firstSequence, another from the secondSequence and finally the 3rd that was thrown in OnFault of secondSequence, but it is all handled in the end, by OnFault group connected to a main sequence.
Assign element that is added in OnFault of main Sequence is:
<assign name="Assign" to="ERROR_MAIN">ERROR FROM A MAIN SEQUENCE</assign>
ProcessData from the end of the process is:
<?xml version="1.0" encoding="UTF-8"?>
<ProcessData>
<firstSequenceVar_1>1_1</firstSequenceVar_1>
<Prev_NotSuccess_Adv_Status>33</Prev_NotSuccess_Adv_Status>
<ERROR_SERVICE>
<WFD_NAME>TEST_onFault_handlingOnFaultError_inMainSequences</WFD_NAME>
<SERVICE_NAME>FS_InstallValidation</SERVICE_NAME>
<STEP_ID>2</STEP_ID>
<ADV_STATUS>No files to collect</ADV_STATUS>
<BASIC_STATUS>1</BASIC_STATUS>
<WFC_ID>lin2:node1:12728cff242:5497625</WFC_ID>
<WFD_NAME>TEST_onFault_handlingOnFaultError_inMainSequences</WFD_NAME>
<SERVICE_NAME>XMLValidator_WellFormed</SERVICE_NAME>
<STEP_ID>6</STEP_ID>
<ADV_STATUS>schema:validationerr</ADV_STATUS>
<BASIC_STATUS>1</BASIC_STATUS>
<WFC_ID>lin2:node1:12728cff242:5497669</WFC_ID>
<WFD_NAME>TEST_onFault_handlingOnFaultError_inMainSequences</WFD_NAME>
<SERVICE_NAME>BPExceptionService</SERVICE_NAME>
<STEP_ID>9</STEP_ID>
<ADV_STATUS>33</ADV_STATUS>
<BASIC_STATUS>1</BASIC_STATUS>
<WFC_ID>lin2:node1:12728cff242:5497702</WFC_ID>
</ERROR_SERVICE>
<ERROR_SEQ1>There is no files to collect from collection Folder!</ERROR_SEQ1>
<secondSequenceVar_1>2_1</secondSequenceVar_1>
<XMLValidationError>
<errorDetail>XML Validation: Failed to get primary document required for transaction to be completed.</errorDetail>
</XMLValidationError>
<ERROR_SEQ2>XML validation error, Primary Document is not well-formed XML</ERROR_SEQ2>
<ERROR_MAIN>ERROR FROM A MAIN SEQUENCE</ERROR_MAIN>
</ProcessData>
Process state:

We can also see that process finished in Completed state:

