klaviyo/php-klaviyo — pull request #2 by nitrix (2013-05-09 16:39:08+00:00)
Title: Handling API errors

### Motivation
Give the developer a mean to log API errors.

### Implementation
Since `identify()`, `track()` and `track_once()` all returns a boolean, we need another method to get any errors returned by the call to the API in case of a failure.

### Usage
You can either call the new `get_error()` method when necessary or always check for an error message in combination with PHP `empty()` function.

### Restrictions
Only the last error message is saved, which should be sufficient for most use cases, as errors are usually dealt with immediately or saved/logged by the developer's code.