github.com/clerkinc/clerk-sdk-go@v1.49.1/clerk/errors.go (about)

     1  package clerk
     2  
     3  import (
     4  	"fmt"
     5  	"net/http"
     6  )
     7  
     8  type ErrorResponse struct {
     9  	Response *http.Response
    10  	Errors   []Error `json:"errors"`
    11  }
    12  
    13  type Error struct {
    14  	Message     string      `json:"message"`
    15  	LongMessage string      `json:"long_message"`
    16  	Code        string      `json:"code"`
    17  	Meta        interface{} `json:"meta,omitempty"`
    18  }
    19  
    20  func (e *ErrorResponse) Error() string {
    21  	return fmt.Sprintf("%v %v: %d %+v",
    22  		e.Response.Request.Method, e.Response.Request.URL,
    23  		e.Response.StatusCode, e.Errors)
    24  }