Add custom error for internal request

This commit is contained in:
bytedream 2022-06-19 00:36:27 +02:00
parent c5f2b55f34
commit 5709012dfe
4 changed files with 29 additions and 9 deletions

17
error.go Normal file
View file

@ -0,0 +1,17 @@
package crunchyroll
import (
"fmt"
"net/http"
)
type RequestError struct {
error
Response *http.Response
Message string
}
func (re *RequestError) String() string {
return fmt.Sprintf("error for endpoint %s (%d): %s", re.Response.Request.URL.String(), re.Response.StatusCode, re.Message)
}