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.
Motivation
Give the developer a mean to log API errors.
Implementation
Since
identify()
,track()
andtrack_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 PHPempty()
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.