fix: restore mobile report scrolling and published product edits
Report pages now scroll inside the chat shell lock, and admin product save forks a draft or retires a published plan instead of rejecting with a generic constraint error. Co-authored-by: Cursor <cursoragent@cursor.com>
This commit is contained in:
@@ -187,6 +187,19 @@ test("adminErrorResponse maps model provider configuration failures without expo
|
||||
}
|
||||
});
|
||||
|
||||
test("adminErrorResponse maps product catalog failures without exposing details", async () => {
|
||||
for (const [error, status, message] of [
|
||||
[new Error("product_not_found"), 404, "商品不存在"],
|
||||
[new Error("product_code_immutable"), 400, "商品代码不可修改"],
|
||||
[new Error("product_draft_not_found"), 400, "只能编辑草稿。已发布商品请下架,或保存为新版本草稿后再发布"],
|
||||
[{ code: "23503", message: "insert or update on table violates foreign key constraint" }, 409, "已有订单或订阅引用该商品,不能硬删除,请改为下架"],
|
||||
] as const) {
|
||||
const response = adminErrorResponse(error);
|
||||
assert.equal(response.status, status);
|
||||
assert.deepEqual(await response.json(), { error: message });
|
||||
}
|
||||
});
|
||||
|
||||
test("adminErrorResponse preserves the sanitized authorization 503", async () => {
|
||||
const response = adminErrorResponse(
|
||||
new AdminAuthorizationError("后台服务暂时不可用", 503),
|
||||
|
||||
Reference in New Issue
Block a user