You have created a nice, well written function, but you realize you forgot something: The failure case.
What should a function do when it fails? There are two schools for this – the “throw an exception” school and the “return an error value” school.
But which of these is the correct approach?
Via Codeutopia
Tags: error, exception, oop, procedural