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