klaviyo / php-klaviyo

PHP wrapper for the Klaviyo API
59 stars 47 forks source link

Handling API errors #2

Closed nitrix closed 5 years ago

nitrix commented 11 years ago

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.

nitrix commented 5 years ago

Closing my PR due to inactivity.