Lessons in Bug Hunting

Yesterday’s lesson in bug hunting: don’t assume you’re an idiot. I spent a few days trying to figure out why my success callback wasn’t being called. It had been working before I updated to jQuery 1.9.0, and I didn’t think I had changed anything. After much head scratching I found out that jQuery 1.9.0 introduced an Ajax() bug where HTTP status 204 is considered an error. A fix is in the jQuery master branch and will be in jQuery 1.9.1.

Today’s lesson in bug hunting: don’t assume you’re not an idiot. I spent hours yesterday and this morning trying to get Mousetrap.js working. I triple-checked my code against Craig’s documentation, verified the library was loading in the browser, etc. It should have worked. But I set a breakpoint on the line that was throwing the error and there was simply no Mousetrap in the global namespace. Having ruled out an error on my part, in desparation I opened mousetrap.js, hoping to find the bug in there. Instead I found… nothing. Yep, something had gone wrong when I downloaded it, and the file was completely empty.

Bottom line: keep in mind that everyone makes mistakes.