Commit 5d8c0c06 authored by 杨培's avatar 杨培

增加异常信息

parent f0ed7539
...@@ -17,14 +17,14 @@ Message::setDebug(); ...@@ -17,14 +17,14 @@ Message::setDebug();
//$ret = Message::sendSms('18019580609', 'Hello World 3'); //$ret = Message::sendSms('18019580609', 'Hello World 3');
try { try {
$ret = Message::sendTemplateSmsAsync('18019580609', 'shop_item_shipped', [ $ret = Message::sendTemplateSms('18019580609', 'shop_item_shipped', [
'order' => '4124', 'order' => '4124',
'express' => '顺丰速运', 'express' => '顺丰速运',
'number' => 'sf123456' 'number' => 'sf123456'
]); ]);
} catch (\Exception $e) { } catch (\internalApi\base\ApiException $e) {
echo $e->getCode().'/'.$e->getMessage(); echo $e->getRemoteClass().': ['.$e->getCode().'] '.$e->getMessage()."\r\n";
$ret = null; exit;
} }
//Message::setUserOnline(12, 60); //Message::setUserOnline(12, 60);
......
...@@ -220,7 +220,16 @@ class JsonRpc ...@@ -220,7 +220,16 @@ class JsonRpc
if (!empty($ret['error'])) { if (!empty($ret['error'])) {
$this->_error($ret['error']['message']); $this->_error($ret['error']['message']);
throw new ApiException($ret['error']['message'], $ret['error']['data']['code'] ?? 0); $errorCode = $ret['error']['data']['code'] ?? 0;
$remote = $ret['error']['code'] == -32000 ? [
'class' => $ret['error']['data']['class'],
'line' => 0,
'file' => '',
'traceString' => ''
] : null;
throw new ApiException($ret['error']['message'], $errorCode, $remote);
} }
return $ret['result']; return $ret['result'];
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment