Making receivers for error pointers. Making new function return pointers. Fixing typo.
This commit is contained in:
parent
c7087c1150
commit
3e90e5db72
2 changed files with 7 additions and 7 deletions
12
errors.go
12
errors.go
|
@ -32,12 +32,12 @@ type TimeoutErr struct {
|
|||
timeout bool
|
||||
}
|
||||
|
||||
func (t TimeoutErr) Timeout() bool {
|
||||
func (t *TimeoutErr) Timeout() bool {
|
||||
return t.timeout
|
||||
}
|
||||
|
||||
func NewTimeoutError(err error) TimeoutErr {
|
||||
return TimeoutErr{error: err, timeout: true}
|
||||
func NewTimeoutError(err error) *TimeoutErr {
|
||||
return &TimeoutErr{error: err, timeout: true}
|
||||
}
|
||||
|
||||
type temporary interface {
|
||||
|
@ -54,13 +54,13 @@ type TemporaryErr struct {
|
|||
temporary bool
|
||||
}
|
||||
|
||||
func (t TemporaryErr) Temporary() bool {
|
||||
func (t *TemporaryErr) Temporary() bool {
|
||||
return t.temporary
|
||||
}
|
||||
|
||||
// Retrying after receiving this error is advised
|
||||
func NewTemporaryError(err error) TemporaryErr {
|
||||
return TemporaryErr{error: err, temporary: true}
|
||||
func NewTemporaryError(err error) *TemporaryErr {
|
||||
return &TemporaryErr{error: err, temporary: true}
|
||||
}
|
||||
|
||||
// Nothing can be done about this error
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue