Boost Azure Demo
This commit is contained in:
18
Backend/internal/http/respond/respond.go
Normal file
18
Backend/internal/http/respond/respond.go
Normal file
@@ -0,0 +1,18 @@
|
||||
// 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())
|
||||
}
|
||||
Reference in New Issue
Block a user