refactor(errors): migrate decisions to {code,msg}

This commit is contained in:
zetaloop
2026-02-28 07:21:51 +08:00
parent 4e2ee5be54
commit cc24a0cbc3
23 changed files with 157 additions and 165 deletions
+4 -4
View File
@@ -1,5 +1,5 @@
import type { Actor } from "@/lib/actor"
import { evaluateOrderTransition } from "@/lib/domain/order-machine"
import type { Actor } from "@/lib/policy/actor"
import type { UserRole } from "@/lib/types"
import { describe, expect, it } from "vitest"
@@ -32,7 +32,7 @@ describe("evaluateOrderTransition", () => {
expect(result.decision).toMatchObject({
ok: false,
reasonCode: "INVALID_STATUS",
error: { code: 400 },
})
expect(result.nextStatus).toBeUndefined()
})
@@ -46,7 +46,7 @@ describe("evaluateOrderTransition", () => {
expect(result.decision).toMatchObject({
ok: false,
reasonCode: "ROLE_FORBIDDEN",
error: { code: 403 },
})
})
@@ -117,7 +117,7 @@ describe("evaluateOrderTransition", () => {
expect(result.decision).toMatchObject({
ok: false,
reasonCode: "ROLE_FORBIDDEN",
error: { code: 403 },
})
})
})