PHP-Xero icon indicating copy to clipboard operation
PHP-Xero copied to clipboard

Unsure how to check for error responses

Open jmound opened this issue 13 years ago • 0 comments

What's the best way to check for an error response? If, for example, you make an API call that succeeds, but the request itself is an error, how should I check?

For example, if you try to create a new invoice when there is a pre-existing approved invoice, the entire API call itself "succeeds" but returns an error, which passes the is_object test that is at the bottom of the readme sample.

The return code looks like this: SimpleXMLElement Object

(
    [ErrorNumber] => 10
    [Type] => ValidationException
    [Message] => A validation exception occurred
    [Elements] => SimpleXMLElement Object
        (
            [DataContractBase] => Array
                (
...

jmound avatar Feb 20 '12 02:02 jmound