mirror of
https://github.com/veops/oneterm.git
synced 2025-10-07 16:20:52 +08:00
feat(backend): errors move to pkg
This commit is contained in:
@@ -7,6 +7,7 @@ import (
|
||||
|
||||
"github.com/veops/oneterm/internal/model"
|
||||
"github.com/veops/oneterm/internal/service"
|
||||
"github.com/veops/oneterm/pkg/errors"
|
||||
)
|
||||
|
||||
var (
|
||||
@@ -15,7 +16,7 @@ var (
|
||||
publicKeyPreHooks = []preHook[*model.PublicKey]{
|
||||
func(ctx *gin.Context, data *model.PublicKey) {
|
||||
if err := publicKeyService.ValidatePublicKey(data); err != nil {
|
||||
ctx.AbortWithError(http.StatusBadRequest, &ApiError{Code: ErrWrongPk, Data: nil})
|
||||
ctx.AbortWithError(http.StatusBadRequest, &errors.ApiError{Code: errors.ErrWrongPk, Data: nil})
|
||||
}
|
||||
},
|
||||
func(ctx *gin.Context, data *model.PublicKey) {
|
||||
|
Reference in New Issue
Block a user