21 lines
305 B
Go

package httpClient
import (
"errors"
"fmt"
)
type HttpError struct {
Code int
}
func (e *HttpError) Error() string { return fmt.Sprintf("httpClient %d", e.Code) }
func IsHTTPStatus(err error, code int) bool {
var he *HttpError
if errors.As(err, &he) {
return he.Code == code
}
return false
}