DZone
Thanks for visiting DZone today,
Edit Profile
  • Manage Email Subscriptions
  • How to Post to DZone
  • Article Submission Guidelines
Sign Out View Profile
  • Post an Article
  • Manage My Drafts
Over 2 million developers have joined DZone.
Log In / Join
Refcards Trend Reports Events Over 2 million developers have joined DZone. Join Today! Thanks for visiting DZone today,
Edit Profile Manage Email Subscriptions Moderation Admin Console How to Post to DZone Article Submission Guidelines
View Profile
Sign Out
Refcards
Trend Reports
Events
Zones
Culture and Methodologies Agile Career Development Methodologies Team Management
Data Engineering AI/ML Big Data Data Databases IoT
Software Design and Architecture Cloud Architecture Containers Integration Microservices Performance Security
Coding Frameworks Java JavaScript Languages Tools
Testing, Deployment, and Maintenance Deployment DevOps and CI/CD Maintenance Monitoring and Observability Testing, Tools, and Frameworks
Partner Zones AWS Cloud
by AWS Developer Relations
Culture and Methodologies
Agile Career Development Methodologies Team Management
Data Engineering
AI/ML Big Data Data Databases IoT
Software Design and Architecture
Cloud Architecture Containers Integration Microservices Performance Security
Coding
Frameworks Java JavaScript Languages Tools
Testing, Deployment, and Maintenance
Deployment DevOps and CI/CD Maintenance Monitoring and Observability Testing, Tools, and Frameworks
Partner Zones
AWS Cloud
by AWS Developer Relations
Securing Your Software Supply Chain with JFrog and Azure
Register Today

Trending

  • Step Into Serverless Computing
  • Tactics and Strategies on Software Development: How To Reach Successful Software [Video]
  • Top 10 Pillars of Zero Trust Networks
  • Integrate Cucumber in Playwright With Java

Trending

  • Step Into Serverless Computing
  • Tactics and Strategies on Software Development: How To Reach Successful Software [Video]
  • Top 10 Pillars of Zero Trust Networks
  • Integrate Cucumber in Playwright With Java
  1. DZone
  2. Testing, Deployment, and Maintenance
  3. Testing, Tools, and Frameworks
  4. Error Handling Inside Kumologica Subflow

Error Handling Inside Kumologica Subflow

The article demonstrates the general error handling and skip-on error feature inside the Kumologica subflow.

Pranav K user avatar by
Pranav K
CORE ·
Mar. 27, 23 · Tutorial
Like (2)
Save
Tweet
Share
2.06K Views

Join the DZone community and get the full member experience.

Join For Free

What Is a Subflow?

A subflow in Kumologica is a defined section of a flow that is created using a Subflow In and Subflow Out node. Its purpose is to improve the reusability of code and enhance the readability of the overall flow. The Subflow node can be used to call the subflow from any point in the flow.

Once a Subflow In node is added to the canvas, its name will appear in the dropdown list of the Subflow node. Each subflow execution operates within its own context and does not modify the payload, variables, or message properties.  

Error Handling Approaches

 When it comes to subflows, there are two ways to handle errors. The first approach involves catching the mistake, handling it, and then abruptly stopping any further processing. 

Stop on Error


Alternatively, the second approach is to catch the error and skip to the next processing block without stopping the flow. The second approach is mostly used when you are using the subflow inside a for loop for iteration. Whenever an error occurs inside the loop the catch node instead of wiring to an EvenListener End node will be wired to the For-Loop end node. By doing this the iteration is automatically skipped to the next iteration without doing any other processing associated with the for-loop processing block. Eg: In the below image Node 3 is skipped when thrown at Node 2. 

Skip on error

Implementation

Pre-requisite

1. Node.JS installation (node version: 16.14.0, npm version:  8.3.1)

1. Install the latest Kumologica designer  (3.1.0).

In this article, I will implement a simple Kumologica flow demonstrating both error-handling approaches. Following is the flow which I will be using for this demonstration.

Main flow


Steps

We will first build a subflow that is invoked from the main flow.

Sub flow


1. Click on the Navigator view in the designer and create a new flow by providing a name samplesubflow.

2. Drag and drop Subflow In and Subflow Out nodes from the pallet to the designer.

3. Add an HTTP Req node to the canvas and wire to the Subflow In node. 

4. Wire the HTTP Req node output to Subflow out node.

Provide the configuration for the HTTP Req node as given below.

Plain Text
 
Method : GET
URL : http://httpbin.org/wrongip
Return : a UTF-8 string


5. Now ensure that the main flow (Main flow image above) subflow invoke node is having the Subflow selected.

6.  Add a test case flow as given below to execute the flow to see if an error is generated. The test case flow will have an HTTP TestCase node wired directly to the TestCaseEnd node.

Test Case flow

Testing:

On running the test case from the test case runner option you could see the 404 error response as the HTTP endpoint we provided was incorrect.

Error Response


Stop on Error

1. Now let's capture the error thrown by the HTTP Req node. For this, we will configure a catch node as given below.Configuring Catch node

In the above screen, you can see that the HTTP req node is selected for catching all the errors generated by that node. 

2. Wire the Catch node to the Event Listener End node for sending the error response back to the client.

Configuring EventListener End node


Testing:

On running the test case we can see that error is handled and the custom response is returned by the flow. The flow is abruptly stopped

Handled errors and stopped


Skip on error

1. Now we try implementing skip-on an error by removing the Evenlistener End from the earlier built flow. 

2. Once the Evenlistner End node is removed, we will wire the catch node directly to the Subflow Out node.

Catch node wired directly


Testing:

On running the test case we can see that error is handled and skipped which ultimately completes the flow successfully.

Handled errors and skipped


Conclusion

Hope the article helped you in understanding and effectively use error handling inside a subflow for the appropriate use case. I will come up with a different topic for my next article. Till then stay tuned.

Node.js Plain text Reusability Test case Use case Execution (computing) Flow (web browser) Processing Testing Data Types

Opinions expressed by DZone contributors are their own.

Trending

  • Step Into Serverless Computing
  • Tactics and Strategies on Software Development: How To Reach Successful Software [Video]
  • Top 10 Pillars of Zero Trust Networks
  • Integrate Cucumber in Playwright With Java

Comments

Partner Resources

X

ABOUT US

  • About DZone
  • Send feedback
  • Careers
  • Sitemap

ADVERTISE

  • Advertise with DZone

CONTRIBUTE ON DZONE

  • Article Submission Guidelines
  • Become a Contributor
  • Visit the Writers' Zone

LEGAL

  • Terms of Service
  • Privacy Policy

CONTACT US

  • 600 Park Offices Drive
  • Suite 300
  • Durham, NC 27709
  • support@dzone.com

Let's be friends: