github.com/sagernet/sing@v0.4.0-beta.19.0.20240518125136-f67a0988a636/common/exceptions/extend.go (about)

     1  package exceptions
     2  
     3  type extendedError struct {
     4  	message string
     5  	cause   error
     6  }
     7  
     8  func (e *extendedError) Error() string {
     9  	if e.cause == nil {
    10  		return e.message
    11  	}
    12  	return e.cause.Error() + ": " + e.message
    13  }
    14  
    15  func (e *extendedError) Unwrap() error {
    16  	return e.cause
    17  }