mirror of
https://github.com/interviewstreet/go-jira.git
synced 2024-11-24 08:22:42 +02:00
23 lines
617 B
Go
23 lines
617 B
Go
package jira
|
|
|
|
import (
|
|
"fmt"
|
|
"net/http"
|
|
)
|
|
|
|
// ErrorResponse reports one or more errors caused by an API request.
|
|
type ErrorResponse struct {
|
|
Response *http.Response // HTTP response that caused this error
|
|
ErrorMessages []string `json:"errorMessages,omitempty"`
|
|
Errors map[string]string `json:"errors,omitempty"`
|
|
}
|
|
|
|
func (r *ErrorResponse) Error() string {
|
|
if r.Response == nil {
|
|
return fmt.Sprintf("%v %+v", r.ErrorMessages, r.Errors)
|
|
}
|
|
return fmt.Sprintf("%v %v: %d %v %+v",
|
|
r.Response.Request.Method, r.Response.Request.URL,
|
|
r.Response.StatusCode, r.ErrorMessages, r.Errors)
|
|
}
|