Skip to content

Commit

Permalink
add throw new exception msg
Browse files Browse the repository at this point in the history
  • Loading branch information
zhouaini528 committed Aug 25, 2023
1 parent 0c58804 commit 91f844b
Showing 1 changed file with 4 additions and 2 deletions.
6 changes: 4 additions & 2 deletions src/Api/Trader.php
Original file line number Diff line number Diff line change
Expand Up @@ -40,7 +40,6 @@ class Trader extends Base implements TraderInterface
* */
function buy(array $data,bool $show=true){
try {
//print_r($data);
$requestTrader=$this->map->requestTrader();

$map=$requestTrader->buy($data);
Expand Down Expand Up @@ -72,6 +71,7 @@ function buy(array $data,bool $show=true){

'_order_id'=>$trader['_order_id'] ?? '',
'_client_id'=>$trader['_client_id'] ?? '',
'_trader_result'=>$result
]);
}catch (\Exception $e){
return $this->error($e->getMessage());
Expand Down Expand Up @@ -139,6 +139,7 @@ function sell(array $data,bool $show=true){

'_order_id'=>$trader['_order_id'] ?? '',
'_client_id'=>$trader['_client_id'] ?? '',
'_trader_result'=>$result
]);
}catch (\Exception $e){
return $this->error($e->getMessage());
Expand Down Expand Up @@ -198,6 +199,7 @@ function cancel(array $data,bool $show=true){

'_order_id'=>$trader['_order_id'] ?? '',
'_client_id'=>$trader['_client_id'] ?? '',
'_trader_result'=>$result
]);
}catch (\Exception $e){
return $this->error($e->getMessage());
Expand Down Expand Up @@ -245,7 +247,7 @@ function show(array $data){

return $trader;
}catch (\Exception $e){
return $this->error($e->getMessage(),'system error');
return $this->error(json_encode(array_merge($data,['_msg'=>$e->getMessage()])));
}
}

Expand Down

0 comments on commit 91f844b

Please sign in to comment.