forked from go-kit/kit
-
Notifications
You must be signed in to change notification settings - Fork 0
/
err.go
33 lines (25 loc) · 739 Bytes
/
err.go
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
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)
}