storj/storagenode/blobstore/filestore/error.go
Egon Elbre f5020de57c storagenode/blobstore: move blob store logic
The blobstore implementation is entirely related to storagenode, so the
rightful place is together with the storagenode implementation.

Fixes https://github.com/storj/storj/issues/5754

Change-Id: Ie6637b0262cf37af6c3e558556c7604d9dc3613d
2023-04-05 18:06:20 +00:00

26 lines
484 B
Go

// Copyright (C) 2019 Storj Labs, Inc.
// See LICENSE for copying information.
package filestore
import (
"errors"
"os"
)
// underlyingError returns the underlying error for known os error types.
func underlyingError(err error) error {
var perr *os.PathError
var lerr *os.LinkError
var serr *os.SyscallError
switch {
case errors.As(err, &perr):
return perr.Err
case errors.As(err, &lerr):
return lerr.Err
case errors.As(err, &serr):
return serr.Err
}
return err
}