Catching Activity Faults with Scope and Fault Handlers
A scope and fault handler is defined for activities within a process. The handler catches faults that have been triggered within the scope.
- In the samples directory in the File Explorer view, expand and double-click tibco_bw_sample_core_fault_scopeandfaulthandler.zip to expand it in the Project Explorer. See Accessing Samples for more information.
- In Project Explorer, expand the tibco_bw_sample_core_fault_ScopeAndFaultHandler.
- Fully expand the Processes directory and double-click ScopeFault.bwp to open it in the Process Editor pane.
- Click .
- In the Debug Configuration wizard, expand BusinessWorks Application in the left pane and select BWApplication
- Click the Applications tab and then click the Deselect All button if you have multiple applications selected. Select the check box next to tibco_bw_sample_core_fault_scopeandfaulthandler_application.
- Click Debug. This will run the sample in Debug mode.
icon to stop the process.
The console displays the messages based on the value specified in the input XML provided in the ParseXML activity.
12:49:31.510 INFO [bwEngThread:In-Memory Process Worker-1] c.t.b.p.g.L.t.Log - The mortgage rate is: 3.5
- Optionally, push your application to the cloud. For details on how to do this see Pushing an Application to the Cloud.
Understanding the Configuration
Fault handler mechanism is based on the type of input provided in the ParseXML activity. Catch scope specified at activities level will be executed for any invalid XML input data.
If the XML content specified in ParseXML activity is valid and selected Credit Profile is within the input XML, Success message "The mortgage rate is: 3.5" is displayed for a selected credit profile.
If the XML content specified in ParseXML activity is not valid, activity Scope Catch block is executed for XML Parse exception.
CatchAll scope specified at process level will be executed for occurrence of any other type of exceptions.