How To Perform Error Handling Using Scope?
Conneqtion Group
Oracle Cloud Infrastructure & Oracle SaaS Implementation Partner
In this blog, we will discuss how to perform error handling using Scope.
The best practice design for an integration is to always use invoke actions inside a Scope. Scope gives us fault handler for potential faults which might occur with invoke actions. The scope fault handler gives us the option to control the flow of the integration. We can configure scope handler to handle all exceptions or only a specific exception.
Let’s begin with how to use scope fault handlers.
We will create an integration which takes 2 integer values and performs an addition. However, if a varchar is passed it throws an error.
Step 1 –?Create an App driven Orchestration Integration with a meaningful name. Click on Create.
Step 2 –?Select REST Trigger connection.
Step 3 – Give some meaningful name and Click next.
Step 4 – Enter below details as shown in screenshot and Click Next.
Step 5 – Add 2 Request parameters as shown below.
Step 6 – Select Response payload format in JSON and enter the response payload. Click OK and Next.
Step 7 –?Click next and the summary page will look like below. Click Done.?
Step 8 – Open the mapper and map the addition of Number1 and Number2 in Result as below.
Step 9 –?Add tracking Variable and click Save.
Step 10 – Save integration. Activate and Test it.
In this integration when you pass 2 numbers it generates an output
However when you pass an varchar it gives an error.
Step 11 – To handle this error we will Utilize Scope handler.
Lets add an scope before the mapper.
Enter a name and click Create.
Step 12 – Select Reposition and move the mapper inside the scope. Once the mapper is moved deselect the Reposition.
Step 13 – Now we will create action inside the default handler of scope. Click on Fault Handler and select Default Handler to open it.
Step 14 – Inside the default handler we can create any logic. Below screen shot shows the action that be used inside the handler.
Step 15 – In our integration we will use Return Action to return a meaningful error message for an integration fails due to Varchar.
Open the mapper and add an error message.
Step 16 – Now activate the integration again and test it. The integration now gives us a meaningful error message on passing varchar.