Article 5XPP8 CodeSOD: Caught Something

CodeSOD: Caught Something

by
Remy Porter
from The Daily WTF on (#5XPP8)

One of the easiest ways to create a bug for yourself is to drop an empty catch into your application.

Today's rather short CodeSOD comes from Dex, and was found in a payment process. This is code that handles actual financial transactions, which is why the comment attached to a common mistake is relevant here:

catch // complete fubar but don't crash{}

And yes, when this exception happened, things were "fubar"- broken beyond all recognition, and unable to be recovered from. That's what drew Dex's attention to the code in the first place- trying to understand the mangled transactions which were passing through the system.

As Dex summarizes:

This combines a whole bunch of WTFs:

  1. Error suppression in payment processing code
  2. Try/catch in place of checking error conditions
  3. Willful laziness, as documented the coder's comment
buildmaster-icon.png [Advertisement] Utilize BuildMaster to release your software with confidence, at the pace your business demands. Download today! TheDailyWtf?d=yIl2AUoC8zA
External Content
Source RSS or Atom Feed
Feed Location http://syndication.thedailywtf.com/TheDailyWtf
Feed Title The Daily WTF
Feed Link http://thedailywtf.com/
Reply 0 comments