File: error.go

package info (click to toggle)
golang-github-putdotio-go-putio 0.0~git20190822.19b9c63-2
  • links: PTS, VCS
  • area: main
  • in suites: bullseye
  • size: 168 kB
  • sloc: makefile: 2
file content (25 lines) | stat: -rw-r--r-- 469 bytes parent folder | download | duplicates (2)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
package putio

import (
	"fmt"
	"net/http"
)

// ErrorResponse reports the error caused by an API request.
type ErrorResponse struct {
	Response *http.Response `json:"-"`

	Message string `json:"error_message"`
	Type    string `json:"error_type"`
}

func (e *ErrorResponse) Error() string {
	return fmt.Sprintf(
		"Type: %v Message: %q. Original error: %v %v: %v",
		e.Type,
		e.Message,
		e.Response.Request.Method,
		e.Response.Request.URL,
		e.Response.Status,
	)
}