| 1 |
package plumbing |
| 2 |
|
| 3 |
import "fmt" |
| 4 |
|
| 5 |
type PermanentError struct { |
| 6 |
Err error |
| 7 |
} |
| 8 |
|
| 9 |
func NewPermanentError(err error) *PermanentError { |
| 10 |
if err == nil { |
| 11 |
return nil |
| 12 |
} |
| 13 |
|
| 14 |
return &PermanentError{Err: err} |
| 15 |
} |
| 16 |
|
| 17 |
func (e *PermanentError) Error() string { |
| 18 |
return fmt.Sprintf("permanent client error: %s", e.Err.Error()) |
| 19 |
} |
| 20 |
|
| 21 |
type UnexpectedError struct { |
| 22 |
Err error |
| 23 |
} |
| 24 |
|
| 25 |
func NewUnexpectedError(err error) *UnexpectedError { |
| 26 |
if err == nil { |
| 27 |
return nil |
| 28 |
} |
| 29 |
|
| 30 |
return &UnexpectedError{Err: err} |
| 31 |
} |
| 32 |
|
| 33 |
func (e *UnexpectedError) Error() string { |
| 34 |
return fmt.Sprintf("unexpected client error: %s", e.Err.Error()) |
| 35 |
} |