refactor(onebot): drop redundant per-action try/catch in qzone/album/admin
阶段 2a:删除 qzone(7)、group-album(8)、group-admin(1) 共 16 个「纯兜底再包一层」 的 try/catch,让抛错自然落到唯一 seam runAction(阶段 1 已统一为 ACTION_FAILED 100 + error.message)。qzone/album 原返回 1200 → 归一 100(本任务有意);group-admin 原本就是 100,仅去冗余包装。 - 保留:qzone helper uploadQzoneImages 的带前缀 re-throw catch、group-info 的 honor-info 前缀 catch、message 的吞值 catch(best-effort 保留旧 URL)——均未动。 - 清理三文件不再使用的 RETCODE/failedResponse import。 - qzone-actions 测试断言 1200 → 100(wording 前缀经 seam 仍保留)。 - onebot 全量 516 全绿、typecheck 干净;对抗性 Agent 逐个对比 HEAD 确认纯兜底、 无其它漂移、无误删漏改。
This commit is contained in:
4 files changed
+51
-130
No files matched your search
@@ -1,6 +1,6 @@
|
||||
import { defineAction, groupAction, groupUserAction, registerActions, f } from '../action-kit';
|
||||
import type { ApiActionContext, ApiHandler } from '../api-handler';
|
||||
import { RETCODE, failedResponse, okResponse } from '../types';
|
||||
import { okResponse } from '../types';
|
||||
|
||||
export const actions = [
|
||||
groupUserAction({
|
||||
@@ -120,12 +120,8 @@ export const actions = [
|
||||
summary: '设置群头像',
|
||||
params: { file: f.image() },
|
||||
run: async (p, ctx) => {
|
||||
try {
|
||||
await ctx.bridge.apis.profile.setGroupAvatar(p.group_id, p.file);
|
||||
return okResponse();
|
||||
} catch (err) {
|
||||
return failedResponse(RETCODE.ACTION_FAILED, err instanceof Error ? err.message : String(err));
|
||||
}
|
||||
await ctx.bridge.apis.profile.setGroupAvatar(p.group_id, p.file);
|
||||
return okResponse();
|
||||
},
|
||||
}),
|
||||
];
|
||||
|
||||
Reference in new issue
Block a user