Hey,

Returning error codes and null force then handler to deal the error case.
Often this is for no good reason, and often the handler cannot decide how
to deal with such an error, and is forced to simply pass it on. In such
cases, it is just silly to have in-band error handling. This is what
exceptions are for.

The linked library has documentation that describes some of the problems of
using such return values. Based on those docs, it seems like a good way to
get around these problems for the null/false case. So if the choice is
between returning null/false or using this library, I'd at least give the
library a try.

Some further remarks:

* Exceptions should not be used for control flow of non-error cases
* Returning error codes is problematic and is not solved by this library,
Exceptions should typically be used

Remarks on the usage of this library:

* Is a WMF team really going to use a third-party library distributed via
Composer? :)
* It has over half a million downloads on Packagist, so is probably pretty
solid
* It has tests and runs them on TravisCI \o/

Cheers

--
Jeroen De Dauw
http://www.bn2vs.com
Don't panic. Don't be evil. ~=[,,_,,]:3
--
_______________________________________________
Wikitech-l mailing list
Wikitech-l@lists.wikimedia.org
https://lists.wikimedia.org/mailman/listinfo/wikitech-l

Reply via email to