尝试登录逻辑

This commit is contained in:
des
2026-01-19 00:07:20 +08:00
parent c61fb947e7
commit 2d65afdf33
16 changed files with 713 additions and 66 deletions

27
srv/internal/ero/error.go Normal file
View File

@@ -0,0 +1,27 @@
package ero
import "net/http"
type Type int
const (
// ServerError 通用的,不需要特殊处理暴露给前端的错误
ServerError Type = iota
// FormError 表单校验异常没有执行成功。Data 内会有明确的字段级错误返回给前端处理
FormError
)
// GeneralError 通用的错误数据包装
type GeneralError struct {
Status int
// Type 错误类型,参考自定义类型 Type
Type Type
// Message 当前错误的简短解释
Message string
// Data 如果是复杂错误,此处会返回前端协助前端展示错误的数据
Data any
}
func SimpleError(msg string) *GeneralError {
return &GeneralError{http.StatusInternalServerError, ServerError, msg, nil}
}