本站源代码
You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

36 lines
589B

  1. package plumbing
  2. import "fmt"
  3. type PermanentError struct {
  4. Err error
  5. }
  6. func NewPermanentError(err error) *PermanentError {
  7. if err == nil {
  8. return nil
  9. }
  10. return &PermanentError{Err: err}
  11. }
  12. func (e *PermanentError) Error() string {
  13. return fmt.Sprintf("permanent client error: %s", e.Err.Error())
  14. }
  15. type UnexpectedError struct {
  16. Err error
  17. }
  18. func NewUnexpectedError(err error) *UnexpectedError {
  19. if err == nil {
  20. return nil
  21. }
  22. return &UnexpectedError{Err: err}
  23. }
  24. func (e *UnexpectedError) Error() string {
  25. return fmt.Sprintf("unexpected client error: %s", e.Err.Error())
  26. }
上海开阖软件有限公司 沪ICP备12045867号-1