rossking/nest-api — pull request #1 by rossking (2014-04-12 01:21:48+00:00)
Title: Update nest.class.php

Adjusted code to not die but to throw a runtime exception on all errors so that this works to capture errors

try {
$nest = new Nest();
$infos = $nest->getDeviceInfo();
} catch (RuntimeException $ex) {
if ($ex->getCode() != NESTAPI_ERROR_EMPTY_RESPONSE && $ex->getCode() != NESTAPI_ERROR_NOT_JSON_RESPONSE) {
echo $ex->getMessage();
}
}