JeffreyHyer/bamboohr-laravel

$response->hasErrors() returning false even if the calls return 503

Closed this issue · 1 comments

I try to request using to bamboohr api using wrong subdomain and key.

$response->getCode()
returns 503

but when I do
$response->hasErros()
returns false

@kszyrvercobrador the hasErrors() method is a shortcut to access the error message(s) returned from BambooHR in the HTTP headers. In your case a 503 error doesn't have any error messages so there are no errors to return.

In practice, you should use both getCode() and hasErrors() to determine if the request was successful.

If you're interested in the details you can see the implementation of hasErrors() and getErrors(). The real work happens here: _getErrors()