github.com/grafana/pyroscope@v1.18.0/pkg/objstore/not_found.go (about)

     1  package objstore
     2  
     3  import (
     4  	"errors"
     5  
     6  	"github.com/thanos-io/objstore"
     7  )
     8  
     9  func IsNotExist(b objstore.BucketReader, err error) bool {
    10  	// objstore relies on the Causer interface
    11  	// and does not understand wrapped errors.
    12  	return b.IsObjNotFoundErr(UnwrapErr(err))
    13  }
    14  
    15  func UnwrapErr(err error) error {
    16  	for {
    17  		unwrapped := errors.Unwrap(err)
    18  		if unwrapped == nil {
    19  			return err
    20  		}
    21  		err = unwrapped
    22  	}
    23  }