DEV Community

Vivek Verma
Vivek Verma

Posted on • Edited on

Failed, TryAgain.... Implement Retry Functionality in your code

If you are a software engineer you must have encountered some piece of code that sometimes work and sometimes doesnot.

Image description

Why do you need Retry

Well, you failed. But don't you worry, You have lot of retries left but it;s good to know what made you fail so you are prepared for it. Even in software word where everything is perdefined, there are lot of factors we can not control. There are sveral reasons a piece of code could fail.

  1. Network Failures
  2. Third Party Failures.
  3. Database opereation failures.

Retry Using Loops

A simple way of retrying is that having the operation in a loop for n times and it comes out of the loop if it is successfull or we can return the error in case if it is not successful


Enter fullscreen mode Exit fullscreen mode

Top comments (0)

Billboard image

Try REST API Generation for MS SQL Server.

DreamFactory generates live REST APIs from database schemas with standardized endpoints for tables, views, and procedures in OpenAPI format. We support on-prem deployment with firewall security and include RBAC for secure, granular security controls.

See more!

👋 Kindness is contagious

Explore a trove of insights in this engaging article, celebrated within our welcoming DEV Community. Developers from every background are invited to join and enhance our shared wisdom.

A genuine "thank you" can truly uplift someone’s day. Feel free to express your gratitude in the comments below!

On DEV, our collective exchange of knowledge lightens the road ahead and strengthens our community bonds. Found something valuable here? A small thank you to the author can make a big difference.

Okay