code-intelligence.com/cifuzz@v0.40.0/pkg/finding/finding_errors.go (about)

     1  package finding
     2  
     3  import "github.com/pkg/errors"
     4  
     5  // A NotExistError indicates that the specified finding does not exist
     6  type NotExistError struct {
     7  	err error
     8  }
     9  
    10  func (e NotExistError) Error() string {
    11  	return e.err.Error()
    12  }
    13  
    14  func (e NotExistError) Unwrap() error {
    15  	return e.err
    16  }
    17  
    18  // WrapNotExistError wraps an existing error into a
    19  // NotExistError to hint on disabling the sandbox when the error
    20  // is handled.
    21  func WrapNotExistError(err error) error {
    22  	return &NotExistError{err}
    23  }
    24  
    25  func IsNotExistError(err error) bool {
    26  	var notExistErr *NotExistError
    27  	return errors.As(err, &notExistErr)
    28  }