I love the way Golang makes us handle errors

Arpit Bhayani

Arpit Bhayani

Apr 23, 2025 • 1 min read


I love the way Golang makes us handle errors.

Instead of raising and throwing exceptions, like many other programming languages, Go treats errors as first-class citizens and lets us return them from the function, making them an integral part of the program’s flow.

I prefer this over traditional exceptions because it shifts our perspective from thinking of it as an odd, infrequent event to something we need to be aware of at every step and be in a position to handle gracefully.

By returning errors from the functions, we can also let them travel upwards through parent functions, reaching the appropriate handler and giving the code the necessary clarity and predictability.

Personally, this makes the code more robust as it removes the possibility of silent failures, enabling us to attain high availability for our services.

Arpit Bhayani

Principal Engineer II at Razorpay - building Agent Studio, Ex-staff engg at GCP Memorystore & Dataproc, Creator of DiceDB, ex-Amazon Fast Data, ex-Director of Engg. SRE and Data Engineering at Unacademy. I spark engineering curiosity through my no-fluff engineering videos on YouTube and my courses