Throw exception on session initialization error
This commit is contained in:
parent
8cff7f8a6f
commit
a6a4e20ca0
|
@ -29,12 +29,12 @@ class FileSystemListing extends Service {
|
||||||
'removeHidden' => $removeHidden,
|
'removeHidden' => $removeHidden,
|
||||||
]);
|
]);
|
||||||
|
|
||||||
$FsTask_xs = $rest->getCurlResponse()['result'];
|
$FileInfo_xs = $rest->getCurlResponse()['result'];
|
||||||
$FsTasks = [];
|
$FileInfos = [];
|
||||||
foreach( $FsTask_xs as $fsTask_x) {
|
foreach( $FileInfo_xs as $FileInfo_x) {
|
||||||
$FsTasks[] = new FileInfo( $fsTask_x);
|
$FileInfos[] = new FileInfo( $FileInfo_x);
|
||||||
}
|
}
|
||||||
return $FsTasks;
|
return $FileInfos;
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
|
|
@ -48,6 +48,9 @@ class Session extends Service {
|
||||||
'password' => hash_hmac( 'sha1', $this->challenge, $this->application->getAppToken()),
|
'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'];
|
$this->session_token = $rest->getCurlResponse()['result']['session_token'];
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue