When an error occurs the details will be stored in the $error var. For example the following code will print out an error on failure.
$var = $store->get('/products');
if(isset($var) {
do something;
} else {
print_r($error);
}
A 401 will not error as quickly, but after some minutes of trying it should behave the same and return the 401 error details within the $error var.