 Documentation
      ¶
      Documentation
      ¶
    
    
  
    
  
    Index ¶
Constants ¶
      View Source
      
  const HTTPStatusErrorBodyMaxLength = 64 * 1024
    HTTPStatusErrorBodyMaxLength specifies the maximum length of HTTPStatusError.Body
Variables ¶
This section is empty.
Functions ¶
func Successful ¶
Successful returns an error if the status code is not 2xx.
func WriteError ¶
WriteError writes an error. WriteError sould not be used if an error may contain sensitive information and the client is not reliable.
Types ¶
type ErrorJSON ¶
type ErrorJSON struct {
	Message string `json:"message"`
}
    ErrorJSON is returned with "application/json" content type and non-2XX status code
type HTTPStatusError ¶
type HTTPStatusError struct {
	// StatusCode is non-2XX status code
	StatusCode int
	// Body is at most HTTPStatusErrorBodyMaxLength
	Body string
}
    HTTPStatusError is created from non-2XX HTTP response
func (*HTTPStatusError) Error ¶
func (e *HTTPStatusError) Error() string
Error implements error. If e.Body is a marshalled string of api.ErrorJSON, Error returns ErrorJSON.Message . Otherwise Error returns a human-readable string that contains e.StatusCode and e.Body.
 Click to show internal directories. 
   Click to hide internal directories.