fix(cert-plugin): 优化又拍云客户端错误处理逻辑,当域名已绑定证书时不再抛出异常。

This commit is contained in:
xiaojunnuo
2026-03-03 14:35:50 +08:00
parent 78c2ced43b
commit 92c9ac3826
3 changed files with 11 additions and 4 deletions

View File

@@ -133,7 +133,7 @@ export abstract class CertApplyBasePlugin extends CertApplyBaseConvertPlugin {
}
/**
* 检查是否过期,默认提前35天
* 检查是否过期,默认提前15天
* @param expires
* @param maxDays
*/

View File

@@ -16,7 +16,7 @@ import { PrivateKeyType } from "./dns.js";
desc: "支持海量DNS解析提供商推荐使用一样的免费通配符域名证书申请支持多个域名打到同一个证书上",
default: {
input: {
renewDays: 35,
renewDays: 15,
forceUpdate: false,
},
strategy: {

View File

@@ -71,11 +71,18 @@ export class UpyunClient {
Cookie: req.cookie
}
});
let errorMessage = null;
if (res.msg?.errors?.length > 0) {
throw new Error(JSON.stringify(res.msg));
errorMessage = JSON.stringify(res.msg);
}
if(res.data?.error_code){
throw new Error(res.data?.message);
errorMessage = res.data?.message;
}
if(errorMessage){
if (errorMessage.includes("domain has been bound to this certificate")) {
return res;
}
throw new Error(errorMessage);
}
return res;
}