github.com/weaviate/weaviate@v1.24.6/entities/storobj/errors.go (about)

     1  //                           _       _
     2  // __      _____  __ ___   ___  __ _| |_ ___
     3  // \ \ /\ / / _ \/ _` \ \ / / |/ _` | __/ _ \
     4  //  \ V  V /  __/ (_| |\ V /| | (_| | ||  __/
     5  //   \_/\_/ \___|\__,_| \_/ |_|\__,_|\__\___|
     6  //
     7  //  Copyright © 2016 - 2024 Weaviate B.V. All rights reserved.
     8  //
     9  //  CONTACT: hello@weaviate.io
    10  //
    11  
    12  package storobj
    13  
    14  import "fmt"
    15  
    16  type ErrNotFound struct {
    17  	DocID       uint64
    18  	OriginalMsg string
    19  }
    20  
    21  func NewErrNotFoundf(docID uint64, msg string, args ...interface{}) error {
    22  	return ErrNotFound{
    23  		DocID:       docID,
    24  		OriginalMsg: fmt.Sprintf(msg, args...),
    25  	}
    26  }
    27  
    28  func (err ErrNotFound) Error() string {
    29  	return fmt.Sprintf("no object found for doc id %d: %s", err.DocID, err.OriginalMsg)
    30  }