forked from TrueCloudLab/frostfs-node
[#1247] *: Clarify docs about returned errors from apistatus
package
`apistatus` package provides types which implement build-in `error` interface. Add `error of type` pattern when documenting these errors in order to clarify how these errors should be handled (e.g. `errors.Is` is not good). Signed-off-by: Leonard Lyubich <leonard@nspcc.ru>
This commit is contained in:
parent
459bdcf04b
commit
318639e5bf
24 changed files with 33 additions and 33 deletions
|
@ -9,7 +9,7 @@ import (
|
|||
|
||||
// Get returns object from write-cache.
|
||||
//
|
||||
// Returns apistatus.ObjectNotFound if requested object is missing in write-cache.
|
||||
// Returns an error of type apistatus.ObjectNotFound if requested object is missing in write-cache.
|
||||
func (c *cache) Get(addr *addressSDK.Address) (*objectSDK.Object, error) {
|
||||
saddr := addr.String()
|
||||
|
||||
|
@ -48,7 +48,7 @@ func (c *cache) Get(addr *addressSDK.Address) (*objectSDK.Object, error) {
|
|||
|
||||
// Head returns object header from write-cache.
|
||||
//
|
||||
// Returns apistatus.ObjectNotFound if requested object is missing in write-cache.
|
||||
// Returns an error of type apistatus.ObjectNotFound if requested object is missing in write-cache.
|
||||
func (c *cache) Head(addr *addressSDK.Address) (*objectSDK.Object, error) {
|
||||
// TODO: #1149 easiest to implement solution is presented here, consider more efficient way, e.g.:
|
||||
// - provide header as common object.Object to Put, but marked to prevent correlation with full object
|
||||
|
@ -68,7 +68,7 @@ func (c *cache) Head(addr *addressSDK.Address) (*objectSDK.Object, error) {
|
|||
// Get fetches object from the underlying database.
|
||||
// Key should be a stringified address.
|
||||
//
|
||||
// Returns apistatus.ObjectNotFound if requested object is missing in db.
|
||||
// Returns an error of type apistatus.ObjectNotFound if requested object is missing in db.
|
||||
func Get(db *bbolt.DB, key []byte) ([]byte, error) {
|
||||
var value []byte
|
||||
err := db.View(func(tx *bbolt.Tx) error {
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue