backend/app/zeus/api/lark/internal/user/error.go

28 lines
552 B
Go
Raw Normal View History

2022-01-13 02:23:00 +08:00
package user
import "github.com/gofiber/fiber/v2"
var ErrorUser = fiber.NewError(0, "错误")
func NewError(msg string) error {
return fiber.NewError(fiber.StatusInternalServerError, msg)
}
func NewErrorWithCode(code int, msg string) error {
return fiber.NewError(code, msg)
}
func WarpError(err error) error {
if err == nil {
return nil
}
return fiber.NewError(fiber.StatusInternalServerError, err.Error())
}
func WarpErrorWithCode(code int, err error) error {
if err == nil {
return nil
}
return fiber.NewError(code, err.Error())
}