When Success is an Exception

Developing Resilient Microservices on the Clouds

“Everything fails all the time”

The famous words of Werner Vogels, remind us again and again — never take things for granted.

Root Cause

I have seen new developers learn from a variety of tutorials. And I feel the root of the problem is right there. Most of the introductory tutorials and videos available to us (developed by well meaning experts), do not talk about errors. Somehow, the error handling is left out — to be learnt “when you grow up”. Unfortunately, we never grow up and our code does not handle errors.

Developing for Errors

As they say, the greatest hurdle in exception handling is that we call it an exception. We have to understand that error is not an exception. Error is the normal behavior. Success is an exception.

  • Dependency Errors
  • Internal Errors
  • System Errors

Input Errors

  • wrong format
  • wrong source of data
  • out of sequence
  • delayed data

Dependency Errors

  • Incorrect response
  • Service down
  • Delay

System Errors

Everything can fail — not just my code. Services can fail for a variety of reasons. An upgraded OS could throw tantrums. A network connection can fail. A nerd may push in the wrong version of code… anything can go wrong! The world around may not stop with this. Will our code continue? It should.

Internal Errors


The whole idea in error handling is that we should doubt everything. It may be a well established S3 service on the AWS cloud or it could be a code written by the newly hired intern. Potentially, anything can fail.

Get the Medium app

A button that says 'Download on the App Store', and if clicked it will lead you to the iOS App store
A button that says 'Get it on, Google Play', and if clicked it will lead you to the Google Play store