mirror of
https://github.com/crunchy-labs/crunchy-cli.git
synced 2026-01-21 12:12:00 -06:00
Add custom error for internal request
This commit is contained in:
parent
c5f2b55f34
commit
5709012dfe
4 changed files with 29 additions and 9 deletions
17
error.go
Normal file
17
error.go
Normal 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)
|
||||
}
|
||||
Loading…
Add table
Add a link
Reference in a new issue