init
This commit is contained in:
20
xiangj-adapter/internal/apperror/apperror.go
Normal file
20
xiangj-adapter/internal/apperror/apperror.go
Normal file
@@ -0,0 +1,20 @@
|
||||
package apperror
|
||||
|
||||
import "github.com/gofiber/fiber/v2"
|
||||
|
||||
type AppError struct {
|
||||
Status int
|
||||
Message string
|
||||
}
|
||||
|
||||
func (e *AppError) Error() string {
|
||||
return e.Message
|
||||
}
|
||||
|
||||
func BadRequest(message string) *AppError {
|
||||
return &AppError{Status: fiber.StatusBadRequest, Message: message}
|
||||
}
|
||||
|
||||
func Internal(message string) *AppError {
|
||||
return &AppError{Status: fiber.StatusInternalServerError, Message: message}
|
||||
}
|
||||
Reference in New Issue
Block a user