mirror of
https://github.com/schroinerxy/cloud-mail.git
synced 2026-06-21 19:35:50 +08:00
部署报错详细提示
This commit is contained in:
@@ -12,6 +12,19 @@ app.onError((err, c) => {
|
||||
}else {
|
||||
console.error(err);
|
||||
}
|
||||
|
||||
if (err.message === `Cannot read properties of undefined (reading 'get')`) {
|
||||
return c.text('初始化失败:KV数据库未绑定或变量名错误 Initialization failed: KV database not bound or invalid variable name');
|
||||
}
|
||||
|
||||
if (err.message === `Cannot read properties of undefined (reading 'put')`) {
|
||||
return c.text('初始化失败:KV数据库未绑定或变量名错误 Initialization failed: KV database not bound or invalid variable name');
|
||||
}
|
||||
|
||||
if (err.message === `Cannot read properties of undefined (reading 'prepare')`) {
|
||||
return c.text('初始化失败:D1数据库未绑定或变量名错误 Initialization failed: D1 database not bound or invalid variable name');
|
||||
}
|
||||
|
||||
return c.json(result.fail(err.message, err.code));
|
||||
});
|
||||
|
||||
|
||||
@@ -45,6 +45,7 @@ const en = {
|
||||
roleNameExist: 'Role name already exists',
|
||||
delDefRole: 'Default role cannot be deleted',
|
||||
notJsonDomain: 'Environment variable "domain" must be in JSON format',
|
||||
noDomainVariable: 'Environment variable domain cannot be empty',
|
||||
noOsUpBack: 'Cannot upload background: R2 object storage not configured',
|
||||
noOsDomainUpBack: 'Cannot upload background: R2 domain not configured',
|
||||
starNotExistEmail: 'Starred email does not exist',
|
||||
|
||||
@@ -45,6 +45,7 @@ const zh = {
|
||||
roleNameExist: '身份名已存在',
|
||||
delDefRole: '默认身份不能删除',
|
||||
notJsonDomain: '环境变量domain必须是JSON类型',
|
||||
noDomainVariable: '环境变量domain不能为空',
|
||||
noOsUpBack: 'r2对象存储未配置不能上传背景',
|
||||
noOsDomainUpBack: 'r2域名未配置不能上传背景',
|
||||
starNotExistEmail: '星标的邮件不存在',
|
||||
|
||||
@@ -21,8 +21,10 @@ const settingService = {
|
||||
},
|
||||
|
||||
async query(c) {
|
||||
|
||||
const setting = await c.env.kv.get(KvConst.SETTING, { type: 'json' });
|
||||
let domainList = c.env.domain;
|
||||
|
||||
if (typeof domainList === 'string') {
|
||||
try {
|
||||
domainList = JSON.parse(domainList)
|
||||
@@ -30,6 +32,11 @@ const settingService = {
|
||||
throw new BizError(t('notJsonDomain'));
|
||||
}
|
||||
}
|
||||
|
||||
if (!c.env.domain) {
|
||||
throw new BizError(t('noDomainVariable'));
|
||||
}
|
||||
|
||||
domainList = domainList.map(item => '@' + item);
|
||||
setting.domainList = domainList;
|
||||
return setting;
|
||||
|
||||
Reference in New Issue
Block a user