github.com/1and1/oneandone-cloudserver-sdk-go@v1.4.1/errors.go (about)

     1  package oneandone
     2  
     3  import (
     4  	"fmt"
     5  )
     6  
     7  type errorResponse struct {
     8  	Type    string `json:"type"`
     9  	Message string `json:"message"`
    10  }
    11  
    12  type ApiError struct {
    13  	httpStatusCode int
    14  	message        string
    15  }
    16  
    17  func (e ApiError) Error() string {
    18  	return fmt.Sprintf("%d - %s", e.httpStatusCode, e.message)
    19  }
    20  
    21  func (e *ApiError) HttpStatusCode() int {
    22  	return e.httpStatusCode
    23  }
    24  
    25  func (e *ApiError) Message() string {
    26  	return e.message
    27  }