DEV Community

Discussion on: Tell me a bug story

Collapse
 
bradtaniguchi profile image
Brad • Edited

I had one bug I'll never forget that I experienced after only a few months into my first dev job. It taught me a few very important lesson.

I was writing some AngularJs code a few years ago. I found myself having issues with some errors being introduced in a line of code I added. AngularJs uses the ng-model directive to get/set the value from an input to a value in the controller, but the error kept complaining about the directive not existing.
Now matter what I did, the error didn't go away.

  • I assumed it was my dev-server caching. It wasn't.
  • I assumed it was some browser caching. It wasn't.
  • I assumed it was my editor caching something. It wasn't.
  • I assumed my laptop was getting hacked. It wasn't.
  • I assumed even ng-model was defective in the current situation, or broken. It wasn't.

By this time I had spent half the day on the issue, and was getting pretty frustrated. I eventually started writing a Stack Overflow post with my code. I assumed I met some edge-case only a highly experienced developer would know, or it was a bug with the framework and I hit the jackpot.

While writing my post I miss-typed the word ng-model as ng-modal. A massive tidal wave of inspiration hit. I struggled to contain myself as I searched for the original code and sure enough I found the ng-modal directive instead of ng-model

I nearly cried as my single letter code change finally fixed the problem.

I realized I needed to use some better tooling, as it would of saved me an entire day of work. I also realized I should of asked for help sooner as just reviewing the problem provided me solution. Finally, I realized its better to understand the issue than it is to fix it. I spent half the day trying to fix the issue instead of carefully reading the error provided which stated very clearly: ng-modal instead of ng-model.

Happy bug busting!