mirror of
https://github.com/schroinerxy/cloud-mail.git
synced 2026-06-21 19:35:50 +08:00
新增更多部署错误提示
This commit is contained in:
@@ -14,15 +14,15 @@ app.onError((err, c) => {
|
||||
}
|
||||
|
||||
if (err.message === `Cannot read properties of undefined (reading 'get')`) {
|
||||
return c.json(result.fail('KV数据库未绑定<br>KV database not bound',502));
|
||||
return c.json(result.fail('KV数据库未绑定 KV database not bound',502));
|
||||
}
|
||||
|
||||
if (err.message === `Cannot read properties of undefined (reading 'put')`) {
|
||||
return c.json(result.fail('KV数据库未绑定<br>KV database not bound',502));
|
||||
return c.json(result.fail('KV数据库未绑定 KV database not bound',502));
|
||||
}
|
||||
|
||||
if (err.message === `Cannot read properties of undefined (reading 'prepare')`) {
|
||||
return c.json(result.fail('D1数据库未绑定<br>D1 database not bound',502));
|
||||
return c.json(result.fail('D1数据库未绑定 D1 database not bound',502));
|
||||
}
|
||||
|
||||
return c.json(result.fail(err.message, err.code));
|
||||
|
||||
@@ -50,7 +50,7 @@ export async function initForward(c, params) {
|
||||
mainList = [...new Set(mainList)];
|
||||
|
||||
if (mainList.length === 0) {
|
||||
return c.text('Domain does not exist.');
|
||||
return c.text('DOMAIN does not exist in Cloudflare.');
|
||||
}
|
||||
|
||||
//开启主域名电子邮件路由
|
||||
@@ -62,9 +62,9 @@ export async function initForward(c, params) {
|
||||
});
|
||||
|
||||
const body = await res.json();
|
||||
|
||||
const error = body.errors[0];
|
||||
if(!res.ok) {
|
||||
return c.json(body);
|
||||
return c.text(`${error.code} ${error.message}`);
|
||||
}
|
||||
|
||||
}
|
||||
@@ -93,9 +93,9 @@ export async function initForward(c, params) {
|
||||
});
|
||||
|
||||
const body = await res.json();
|
||||
|
||||
const error = body.errors[0];
|
||||
if(!res.ok) {
|
||||
return c.json(body);
|
||||
return c.text(`${error.code} ${error.message}`);
|
||||
}
|
||||
|
||||
}
|
||||
@@ -112,9 +112,9 @@ export async function initForward(c, params) {
|
||||
});
|
||||
|
||||
const body = await res.json();
|
||||
|
||||
const error = body.errors[0];
|
||||
if(!res.ok) {
|
||||
return c.json(body);
|
||||
return c.text(`${error.code} ${error.message}`);
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
@@ -26,6 +26,10 @@ const settingService = {
|
||||
|
||||
const setting = await c.env.kv.get(KvConst.SETTING, { type: 'json' });
|
||||
|
||||
if (!setting) {
|
||||
throw new BizError('数据库未初始化 Database not initialized.');
|
||||
}
|
||||
|
||||
let domainList = c.env.domain;
|
||||
|
||||
if (typeof domainList === 'string') {
|
||||
|
||||
Reference in New Issue
Block a user