Step 26: Don’t Ignore that Error! ~ Pete Goodliffe

Birat Rai
2 min readOct 26, 2017

--

This is the 26th Step towards gaining the Programming Enlightenment series. If you didn’t learn the 25th Step, read it.

Small hole in a giant ship is enough to cause it to sink, if not repaired in time. In programming a small error unnoticed, will ultimately turn to code-debt, which might take away project to a disastrous release.

Too many a times, we ignore error. May be because, we had a time constraint or we didn’t thought much about it due to plain laziness.

What is Error in code?

Error, what error? It won’t be serious. Honestly. I can ignore it.

try {
// ...do something...
}
catch (...) {}
// ignore errors

Why we shouldn’t ignore error?

Not handling errors leads to:

  • Brittle code: Exciting and hard-to-find bugs.
  • Insecure code: Code might be open for exploitation from hackers.
  • Poor structure: Too many checks to prevent some potential errors

How to look for errors?

  • Powerful IDE now-days highlight or warn about potential error.
  • Lint tools, static code analysis tools like PMD, findBugs can tell us about arrays of error.
  • Memory analysis tool

TL;DR Don’t Ignore the Error. Go through it, you will either fix a potential bug or learn a new stuff.

Go to the series.

Go to 25th Step

Go to the 27th step.

References:

--

--

Birat Rai
Birat Rai

No responses yet