Files
BoostAI/Backend/internal/http/respond/respond.go
2026-05-25 17:05:06 +01:00

19 lines
481 B
Go

// Path: Backend/internal/http/respond/respond.go
package respond
import "github.com/gofiber/fiber/v2"
type ErrorBody struct {
Error string `json:"error"`
Message string `json:"message"`
}
func Error(c *fiber.Ctx, status int, code string, message string) error {
return c.Status(status).JSON(ErrorBody{Error: code, Message: message})
}
func DatabaseError(c *fiber.Ctx, err error) error {
return Error(c, fiber.StatusInternalServerError, "database_error", err.Error())
}