Files
tesseract/internal/apierror/api_error.go

18 lines
357 B
Go

package apierror
import "fmt"
type APIError struct {
StatusCode int `json:"-"`
Code string `json:"code"`
Message string `json:"error,omitempty"`
}
func New(status int, code, message string) *APIError {
return &APIError{status, code, message}
}
func (err *APIError) Error() string {
return fmt.Sprintf("%s: %s", err.Code, err.Message)
}