2014-05-31 BaoXinjian In Capgemini
I. Summary
Workflow often needs to handle exceptions, including standard exceptions and custom exceptions. To handle these exceptions, you must use the wf_core public package.
Contains the following three parts:
- Wf_core: standard package api for handling exceptions in workflow
- Wf_item_actvity_status: used to store the error_name, error_message, and error_stack thrown
- Wf_resource: stores some exceptions inherent in workflow by default, including descriptions of exceptions, which must be called through wf_core.
Ii. Case studies
1. Define an Exception Handing Program for Error handling
2. Call Workflow to trigger this WF_CORE to catch this exception (wf_core.token, wf_core.context, wf_core.raise)
3. view the error_name, error_message, and error_stack stored in wf_item_activity_status.
4. Other information. wf_resources stores common errors.
Iii. Case implementation
Requirement: Customize a workflow exception, which is thrown when workflow is called, and store the exception information in the wf_item_activity_status table.
1. Define an Exception Handing Program for Error handling
1 PROCEDURE invoice_exception_handing(itemtype VARCHAR2, 2 3 itemkey VARCHAR2, 4 5 actid NUMBER, 6 7 funcmode VARCHAR2, 8 9 resultout OUT NOCOPY VARCHAR2) IS10 11 BEGIN12 13 wf_core.token('bxj token arg1','bxj arg1_value');14 15 wf_core.token('bxj token arg2','bxj arg2_value');16 17 wf_core.context('bxj_wf_invoice_approve',18 19 'invoice_exception_handing',20 21 itemtype,22 23 itemkey,24 25 to_char(actid),26 27 funcmode,28 29 'bxj wf_core error <invoice exception handing>');30 31 wf_core.raise('bxj raise error');32 33 END;
2. Call Workflow to trigger this WF_CORE to catch this exception
3. view the error_name, error_message, and error_stack stored in wf_item_activity_status.
(1). Error Name: bxj raise error
(2). Erorr Message: [bxj raise error] bxj token arg1 = bxj arg1_value bxj token arg2 = bxj arg2_value
(3). Error Stack:
Bxj_wf_invoice_approve.invoice_exception_handing (BXJ_WF, BXJ_INVOICE_1004, 788470, RUN, bxj wf_core error <invoice exception handing>)
Wf_Engine_Util.Function_Call (bxj_wf_invoice_approve.invoice_exception_handing, BXJ_WF, BXJ_INVOICE_1004, 788470, RUN)
(4) store ErrorMessage
4. Other information: wf_resources stores the common error. You only need to enter the name as the parameter during the call. Other information exists in the wf_resource table.
Thanks and Regards