golang-lib/web/error.go

18 lines
559 B
Go
Raw Normal View History

2021-06-01 10:51:35 +02:00
package web
2021-07-22 18:16:05 +02:00
import "errors"
2021-07-19 17:59:47 +02:00
// HTTPError is returned in HTTP error responses.
2021-06-01 10:51:35 +02:00
type HTTPError struct {
Message string `json:"message" example:"invalid format"`
Error string `json:"error,omitempty" example:"<internal error message>"`
Data interface{} `json:"data,omitempty" swaggerignore:"true"`
}
// Error strings used for HTTPError.Message.
2021-07-22 18:16:05 +02:00
var (
ErrAPIInvalidRequestFormat = errors.New("Invalid Request Format")
ErrAPIInternalDatabase = errors.New("Internal Database Error")
ErrAPINotFound = errors.New("Not found")
2021-06-01 10:51:35 +02:00
)