Files
tesseract/internal/apierror/api_error.go

18 lines
357 B
Go
Raw Normal View History

2024-12-02 13:45:49 +00:00
package apierror
import "fmt"
type APIError struct {
StatusCode int `json:"-"`
Code string `json:"code"`
Message string `json:"error,omitempty"`
2024-12-02 13:45:49 +00:00
}
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)
}