Throw exception on session initialization error

This commit is contained in:
alphayax 2016-05-18 20:15:03 +02:00
parent 8cff7f8a6f
commit a6a4e20ca0
2 changed files with 8 additions and 5 deletions

View File

@ -29,12 +29,12 @@ class FileSystemListing extends Service {
'removeHidden' => $removeHidden,
]);
$FsTask_xs = $rest->getCurlResponse()['result'];
$FsTasks = [];
foreach( $FsTask_xs as $fsTask_x) {
$FsTasks[] = new FileInfo( $fsTask_x);
$FileInfo_xs = $rest->getCurlResponse()['result'];
$FileInfos = [];
foreach( $FileInfo_xs as $FileInfo_x) {
$FileInfos[] = new FileInfo( $FileInfo_x);
}
return $FsTasks;
return $FileInfos;
}
/**

View File

@ -48,6 +48,9 @@ class Session extends Service {
'password' => hash_hmac( 'sha1', $this->challenge, $this->application->getAppToken()),
]);
if( ! $rest->getCurlResponse()['success']){
throw new \Exception( $rest->getCurlResponse()['error_code'] .' : '. $rest->getCurlResponse()['msg']);
}
$this->session_token = $rest->getCurlResponse()['result']['session_token'];
}