rubenarakelyan/twfyapi — pull request #4 by shankiesan (2014-12-10 09:35:57+00:00)
Title: Object-based error handling

Rubenarakelyan's excellent work on the TWFY API was missing object-based error handling. If you use this class in a plug-in, the existing `die()` method of handling errors isn't effective as there's no way to catch them and deal with them effectively.

This pull request adds object-based error handling. It's still not fully-formed, but instead of `die()`, it returns an object with `error => "An error message here"`. This matches up with the format returned from TWFY if an invalid postcode is found. This allows the application to look for a returned object property of 'error' and handle it accordingly.