优化多个地方

This commit is contained in:
eoao
2025-09-03 08:31:44 +08:00
parent 97a7950808
commit b4954e948b
30 changed files with 156 additions and 89 deletions

View File

@@ -14,15 +14,15 @@ app.onError((err, c) => {
}
if (err.message === `Cannot read properties of undefined (reading 'get')`) {
return c.text('初始化失败:KV数据库未绑定或变量名错误 Initialization failed: KV database not bound or invalid variable name');
return c.json(result.fail('初始化失败:KV数据库未绑定或变量名错误'));
}
if (err.message === `Cannot read properties of undefined (reading 'put')`) {
return c.text('初始化失败:KV数据库未绑定或变量名错误 Initialization failed: KV database not bound or invalid variable name');
return c.json(result.fail('初始化失败:KV数据库未绑定或变量名错误'));
}
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('初始化失败:D1数据库未绑定或变量名错误'));
}
return c.json(result.fail(err.message, err.code));