github.com/bingoohuang/gg@v0.0.0-20240325092523-45da7dee9335/pkg/ginx/anyfn/err.go (about)

     1  package anyfn
     2  
     3  // AdapterError defines the error generated in the processing of adaptor.
     4  type AdapterError struct {
     5  	Err     error
     6  	Context string
     7  }
     8  
     9  // Error returns the error message.
    10  func (e *AdapterError) Error() string { return e.Context + " " + e.Err.Error() }
    11  
    12  // IsAdapterError tells if err is an AdaptorError or not.
    13  func IsAdapterError(err error) bool { _, ok := err.(*AdapterError); return ok }