Skip to content

Commit

Permalink
Throw exception on session initialization error
Browse files Browse the repository at this point in the history
  • Loading branch information
alphayax committed May 18, 2016
1 parent 8cff7f8 commit a6a4e20
Show file tree
Hide file tree
Showing 2 changed files with 8 additions and 5 deletions.
10 changes: 5 additions & 5 deletions freebox/api/v3/services/FileSystem/FileSystemListing.php
Original file line number Diff line number Diff line change
Expand Up @@ -29,12 +29,12 @@ public function getFilesFromDirectory( $DirectoryName = '/Disque dur/', $onlyFol
'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;
}

/**
Expand Down
3 changes: 3 additions & 0 deletions freebox/api/v3/services/login/Session.php
Original file line number Diff line number Diff line change
Expand Up @@ -48,6 +48,9 @@ public function create_session(){
'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'];
}

Expand Down

0 comments on commit a6a4e20

Please sign in to comment.