21 lines
404 B
Go
21 lines
404 B
Go
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}
|
|
}
|