Codebase list golang-github-go-kit-kit / d2f2902b-79c4-43cd-8c09-341e33fc6017/v0.1.0 transport / http / err.go
d2f2902b-79c4-43cd-8c09-341e33fc6017/v0.1.0

Tree @d2f2902b-79c4-43cd-8c09-341e33fc6017/v0.1.0 (Download .tar.gz)

err.go @d2f2902b-79c4-43cd-8c09-341e33fc6017/v0.1.0raw · history · blame

package http

import (
	"fmt"
)

const (
	// DomainNewRequest is an error during request generation.
	DomainNewRequest = "NewRequest"

	// DomainEncode is an error during request or response encoding.
	DomainEncode = "Encode"

	// DomainDo is an error during the execution phase of the request.
	DomainDo = "Do"

	// DomainDecode is an error during request or response decoding.
	DomainDecode = "Decode"
)

// Error is an error that occurred at some phase within the transport.
type Error struct {
	// Domain is the phase in which the error was generated.
	Domain string

	// Err is the concrete error.
	Err error
}

// Error implements the error interface.
func (e Error) Error() string {
	return fmt.Sprintf("%s: %s", e.Domain, e.Err)
}