Skip to content

Commit

Permalink
Add Exception
Browse files Browse the repository at this point in the history
  • Loading branch information
zhouaini528 committed Sep 4, 2019
1 parent 3e4278a commit 7574ba0
Show file tree
Hide file tree
Showing 2 changed files with 9 additions and 4 deletions.
8 changes: 7 additions & 1 deletion src/Api/Trader.php
Original file line number Diff line number Diff line change
Expand Up @@ -191,7 +191,13 @@ function show(array $data){
try {
$map=$this->map->request_trader()->show($data);
$result=$this->platform->trader()->show($map);
return $this->map->response_trader()->show(['result'=>$result,'request'=>$data]);
$trader=$this->map->response_trader()->show(['result'=>$result,'request'=>$data]);

if(isset($trader['_status'])) {
if(in_array($trader['_status'],['FAILURE'])) return ['_error'=>$trader];
}

return $trader;
}catch (\Exception $e){
return $this->error($e->getMessage());
}
Expand Down
5 changes: 2 additions & 3 deletions src/Map/ResponseTraderMap.php
Original file line number Diff line number Diff line change
Expand Up @@ -320,10 +320,9 @@ function update(array $data){
*
* */
function show(array $data){
if(empty($data['result'])) return [];

if(empty($data['result'])) return array_merge($data['result'],['_status'=>'FAILURE','msg'=>'Something went wrong last time']);;
$map=[];

switch ($this->platform){
case 'huobi':{

Expand Down

0 comments on commit 7574ba0

Please sign in to comment.