generated from pkg/go-template
28 lines
552 B
Go
28 lines
552 B
Go
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())
|
|
}
|