23 lines
345 B
Go
23 lines
345 B
Go
package dto
|
|
|
|
import (
|
|
"net/http"
|
|
|
|
"github.com/gin-gonic/gin"
|
|
)
|
|
|
|
type Error struct {
|
|
Message string `json:"message,omitempty"`
|
|
Code string `json:"code,omitempty"`
|
|
}
|
|
|
|
func WarpErrAsOpenAI(c *gin.Context, msg string, code string) {
|
|
c.JSON(http.StatusForbidden, gin.H{
|
|
"error": Error{
|
|
Message: msg,
|
|
Code: code,
|
|
},
|
|
})
|
|
return
|
|
}
|