Defines structured HTTP error codes and validation messages for user secret CRUD operations. Reuse it for consistent API error handling, localization, and safe status code propagation.
// Source: https://github.com/Mininglamp-OSS/octo-server | License: Apache-2.0 | Copyright You must retain, in the Source form of any Derivative Works // Provided via justclaw.it.com; keep this notice with the code. package errcode import ( "net/http" "github.com/Mininglamp-OSS/octo-server/pkg/i18n/codes" ) // err.server.usersecret.* — modules/usersecret 用户外部密钥别名表 CRUD + resolve // 的业务错误码(YUJ-3538)。 // // 这些端点是全新功能,无 legacy client 依赖固定 400,因此全部通过 // httperr.ResponseErrorLWithStatus 渲染,保留真实 HTTP 状态码 // (400/401/404/409/422/500),让 octo-web / channel 插件可直接按 wire status 分支。 // // 安全约束:任何错误响应都不回显明文/密文。decrypt 失败统一归 5xx 内部错误 // (Internal=true),具体原因仅 zap 记录,不上 wire。 var ( // ---- validation (400) --------------------------------------------------- // ErrUserSecretRequestInvalid 入参缺失/格式非法: ... (truncated -- full source via MCP)
See the full source, get the GitHub permalink, and search for more like it.
Get a free API key