Article 5YVWD CodeSOD: Exceptionally TF

CodeSOD: Exceptionally TF

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

Steve's predecessor knows: sometimes, stuff happens that makes you go "WTF". While Steve was reviewing some inherited PHP code, he discovered that this predecessor had built some code to handle those situations.

namespace WtfInc;##use \Exception as Exception;class WTFException extends \Exception{ public function __construct($message = null, $code = null) { if (! $message) { $message = "WTF!?"; } else { $message = "WTF!? " . $message; } parent::__construct($message, $code); }}

Now, Steve tracked down all the places it was actually used, which was not zero, but was only one location:

if ($contents === false) { throw new WTFException("Couldn't read the yaml");}

This confirms what we all already knew: YAML is TRWTF.

otter-icon.png [Advertisement] Otter - Provision your servers automatically without ever needing to log-in to a command prompt. Get started 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