Files
Error-Code-System/domains/register.go
T
weichen 28d2d50743 Enable canonical versioned Go module consumption
Why: Allow consumers to download an immutable module revision without nested source checkouts or local path replacements.

Evidence: SELF package tests and the prior canonical-path rejection are recorded in the Dev dependency-workspace task card; remote consumption is replayed against the committed candidate.

Impact: Change the module identity and its Go imports while preserving API behavior. Existing historical submodule revisions remain buildable.

Refs: Versioned dependencies U1/U3; feature/dependency-workspace
2026-10-13 15:06:48 +00:00

35 lines
1.0 KiB
Go

// Package domains 把种子错误码登记进注册表。
//
// Go 定义是权威来源。同目录 JSON 由导出生成,经 go:embed 提供给不编译 Go 的消费方;
// conformance 测试保证二者一致。导入本包会填充 errcode.Default。
package domains
import "git-ssh.u1680832.nyat.app/weichen/Error-Code-System.git/errcode"
func init() { RegisterAll(errcode.Default) }
// RegisterAll 向 r 登记 sys / agent / squad / intent 四域。重复调用会因码冲突失败。
func RegisterAll(r *errcode.Registry) {
registerSys(r)
registerAgent(r)
registerSquad(r)
registerIntent(r)
}
func must(r *errcode.Registry, def errcode.Definition) {
r.MustRegister(def)
}
func def(code errcode.Code, http int, sev errcode.Severity, retry errcode.Retry, side errcode.SideEffects, summary, hint string, aliases ...string) errcode.Definition {
return errcode.Definition{
Code: code,
HTTP: http,
Severity: sev,
Retry: retry,
SideEffects: side,
Summary: summary,
Hint: hint,
Aliases: aliases,
}
}