github.com/TeaOSLab/EdgeNode@v1.3.8/internal/utils/bfs/errors.go (about)

     1  // Copyright 2024 GoEdge CDN goedge.cdn@gmail.com. All rights reserved. Official site: https://goedge.cn .
     2  
     3  package bfs
     4  
     5  import (
     6  	"errors"
     7  	"os"
     8  )
     9  
    10  var ErrClosed = errors.New("the file closed")
    11  var ErrInvalidHash = errors.New("invalid hash")
    12  var ErrFileIsWriting = errors.New("the file is writing")
    13  
    14  func IsWritingErr(err error) bool {
    15  	return err != nil && errors.Is(err, ErrFileIsWriting)
    16  }
    17  
    18  func IsNotExist(err error) bool {
    19  	return err != nil && os.IsNotExist(err)
    20  }