修改对 TencentCloudSDKException 的处理。
parent
b2bc6b3a6f
commit
7ef0776296
|
@ -1,5 +1,7 @@
|
||||||
package xyz.zhouxy.plusone.sms;
|
package xyz.zhouxy.plusone.sms;
|
||||||
|
|
||||||
|
import org.springframework.stereotype.Service;
|
||||||
|
|
||||||
import com.tencentcloudapi.common.Credential;
|
import com.tencentcloudapi.common.Credential;
|
||||||
import com.tencentcloudapi.common.exception.TencentCloudSDKException;
|
import com.tencentcloudapi.common.exception.TencentCloudSDKException;
|
||||||
import com.tencentcloudapi.common.profile.ClientProfile;
|
import com.tencentcloudapi.common.profile.ClientProfile;
|
||||||
|
@ -8,11 +10,8 @@ import com.tencentcloudapi.sms.v20210111.SmsClient;
|
||||||
import com.tencentcloudapi.sms.v20210111.models.SendSmsRequest;
|
import com.tencentcloudapi.sms.v20210111.models.SendSmsRequest;
|
||||||
import com.tencentcloudapi.sms.v20210111.models.SendSmsResponse;
|
import com.tencentcloudapi.sms.v20210111.models.SendSmsResponse;
|
||||||
|
|
||||||
import org.springframework.stereotype.Service;
|
|
||||||
|
|
||||||
import lombok.extern.slf4j.Slf4j;
|
import lombok.extern.slf4j.Slf4j;
|
||||||
import xyz.zhouxy.plusone.constant.ErrorCodeConsts;
|
import xyz.zhouxy.plusone.exception.SysException;
|
||||||
import xyz.zhouxy.plusone.exception.BizException;
|
|
||||||
import xyz.zhouxy.plusone.sms.SmsProperties.SmsCredentialProperties;
|
import xyz.zhouxy.plusone.sms.SmsProperties.SmsCredentialProperties;
|
||||||
import xyz.zhouxy.plusone.sms.SmsProperties.SmsHttpProperties;
|
import xyz.zhouxy.plusone.sms.SmsProperties.SmsHttpProperties;
|
||||||
import xyz.zhouxy.plusone.sms.SmsProperties.SmsProxyProperties;
|
import xyz.zhouxy.plusone.sms.SmsProperties.SmsProxyProperties;
|
||||||
|
@ -62,14 +61,13 @@ public class TencentSmsServiceImpl implements SmsService {
|
||||||
var res = client.SendSms(req);
|
var res = client.SendSms(req);
|
||||||
|
|
||||||
// 输出json格式的字符串回包
|
// 输出json格式的字符串回包
|
||||||
System.out.println(SendSmsResponse.toJsonString(res));
|
log.info(SendSmsResponse.toJsonString(res));
|
||||||
|
|
||||||
// 也可以取出单个值,你可以通过官网接口文档或跳转到response对象的定义处查看返回字段的定义
|
// 也可以取出单个值,你可以通过官网接口文档或跳转到response对象的定义处查看返回字段的定义
|
||||||
// System.out.println(res.getRequestId());
|
// System.out.println(res.getRequestId());
|
||||||
|
|
||||||
} catch (TencentCloudSDKException e) {
|
} catch (TencentCloudSDKException e) {
|
||||||
log.error(e.getMessage(), e);
|
throw new SysException(e);
|
||||||
throw new BizException(ErrorCodeConsts.DEFAULT_ERROR_CODE, e);
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue