unixfs_errors

package
v0.51.3 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: May 9, 2026 License: Apache-2.0 Imports: 11 Imported by: 0

Documentation

Overview

Package unixfs_errors contains common error definitions.

Index

Constants

This section is empty.

Variables

View Source
var (
	// ErrFsNotFound is returned if the unixfs was not found by id.
	ErrFsNotFound = errors.New("fs not found")
	// ErrExist is returned if the file or directory already exists.
	ErrExist = fs.ErrExist
	// ErrNotExist is returned if the file does not exist.
	ErrNotExist = fs.ErrNotExist
	// ErrClosed is returned if read on a file that is already closed.
	// Note: many functions return context.Canceled instead.
	ErrClosed = fs.ErrClosed

	// ErrReadOnly is returned if the FSCursor is read-only.
	ErrReadOnly = errors.New("read-only fs")
	// ErrReleased is returned if a FSCursor or Inode are released.
	ErrReleased = errors.New("cursor or inode released")
	// ErrNotDirectory is returned if mkdir on an inode that is not a directory.
	ErrNotDirectory = errors.New("not a directory")
	// ErrNotFile is returned if write or read on an inode that is not a file.
	ErrNotFile = errors.New("not a file")
	// ErrOutOfBounds indicates a directory index was out of bounds.
	ErrOutOfBounds = errors.New("dirent out of bounds")
	// ErrEmptyPath is returned if the FSPath was empty.
	ErrEmptyPath = errors.New("empty path")
	// ErrAbsolutePath is returned if the FSPath cannot be absolute (but was).
	ErrAbsolutePath = errors.New("absolute path not allowed")
	// ErrInodeUnresolvable is returned if the inode could not be resolved in time.
	ErrInodeUnresolvable = errors.New("inode unable to be resolved")
	// ErrNotSymlink is returned if readlink is called on a non-symlink entry.
	ErrNotSymlink = errors.New("not a symlink")
	// ErrEmptyTimestamp is returned if a timestamp cannot be empty but was empty.
	ErrEmptyTimestamp = timestamppb.ErrEmptyTimestamp
	// ErrMoveToSelf is returned if attempting to move or copy a path to itself.
	ErrMoveToSelf = errors.New("cannot copy/move a path into itself")
	// ErrInvalidWrite means that a write returned an impossible count.
	ErrInvalidWrite = errors.New("invalid write result")
	// ErrEmptyUnixFsId is returned if the filesystem id is empty.
	ErrEmptyUnixFsId = errors.New("empty unixfs id")
	// ErrCrossFsRename is retruned if we try to rename across two unrelated FS.
	ErrCrossFsRename = errors.New("cross-fs rename unimplemented")
	// ErrUnknown is returned if a remote service returned an unknown error.
	ErrUnknown = errors.New("unknown unixfs error")
)
View Source
var (
	UnixFSErrorType_name = map[int32]string{
		0:  "NONE",
		1:  "OTHER",
		2:  "FS_NOT_FOUND",
		3:  "EXIST",
		4:  "NOT_EXIST",
		5:  "CLOSED",
		6:  "READ_ONLY",
		7:  "RELEASED",
		8:  "NOT_DIRECTORY",
		9:  "NOT_FILE",
		10: "OUT_OF_BOUNDS",
		11: "EMPTY_PATH",
		12: "ABSOLUTE_PATH",
		13: "INODE_UNRESOLVABLE",
		14: "NOT_SYMLINK",
		15: "EMPTY_TIMESTAMP",
		16: "MOVE_TO_SELF",
		17: "INVALID_WRITE",
		18: "EMPTY_UNIXFS_ID",
		21: "CROSS_FS_RENAME",
		19: "CONTEXT_CANCELED",
		20: "EOF",
	}
	UnixFSErrorType_value = map[string]int32{
		"NONE":               0,
		"OTHER":              1,
		"FS_NOT_FOUND":       2,
		"EXIST":              3,
		"NOT_EXIST":          4,
		"CLOSED":             5,
		"READ_ONLY":          6,
		"RELEASED":           7,
		"NOT_DIRECTORY":      8,
		"NOT_FILE":           9,
		"OUT_OF_BOUNDS":      10,
		"EMPTY_PATH":         11,
		"ABSOLUTE_PATH":      12,
		"INODE_UNRESOLVABLE": 13,
		"NOT_SYMLINK":        14,
		"EMPTY_TIMESTAMP":    15,
		"MOVE_TO_SELF":       16,
		"INVALID_WRITE":      17,
		"EMPTY_UNIXFS_ID":    18,
		"CROSS_FS_RENAME":    21,
		"CONTEXT_CANCELED":   19,
		"EOF":                20,
	}
)

Enum value maps for UnixFSErrorType.

Functions

This section is empty.

Types

type UnixFSError

type UnixFSError struct {

	// ErrorType is the type of error, zero if none.
	ErrorType UnixFSErrorType `protobuf:"varint,1,opt,name=error_type,json=errorType,proto3" json:"errorType,omitempty"`
	// ErrorBody is the body of the error.
	// If this is set and the error is type OTHER, return errors.New(ErrorBody).
	// If this is set and the error is another type, return errors.Wrap(the_error, ErrorBody).
	// If this is unset and error_type is OTHER, return errors.New("unknown unixfs error").
	ErrorBody string `protobuf:"bytes,2,opt,name=error_body,json=errorBody,proto3" json:"errorBody,omitempty"`
	// contains filtered or unexported fields
}

UnixFSError contains an RPC error returned by a cursor, if any.

func NewUnixFSError

func NewUnixFSError(err error) *UnixFSError

NewUnixFSError converts a Go error into a UnixFS error.

func (*UnixFSError) CloneMessageVT

func (m *UnixFSError) CloneMessageVT() protobuf_go_lite.CloneMessage

func (*UnixFSError) CloneVT

func (m *UnixFSError) CloneVT() *UnixFSError

func (*UnixFSError) EqualMessageVT

func (this *UnixFSError) EqualMessageVT(thatMsg any) bool

func (*UnixFSError) EqualVT

func (this *UnixFSError) EqualVT(that *UnixFSError) bool

func (*UnixFSError) GetErrorBody

func (x *UnixFSError) GetErrorBody() string

func (*UnixFSError) GetErrorType

func (x *UnixFSError) GetErrorType() UnixFSErrorType

func (*UnixFSError) MarshalJSON

func (x *UnixFSError) MarshalJSON() ([]byte, error)

MarshalJSON marshals the UnixFSError to JSON.

func (*UnixFSError) MarshalProtoJSON

func (x *UnixFSError) MarshalProtoJSON(s *json.MarshalState)

MarshalProtoJSON marshals the UnixFSError message to JSON.

func (*UnixFSError) MarshalProtoText

func (x *UnixFSError) MarshalProtoText() string

func (*UnixFSError) MarshalToSizedBufferVT

func (m *UnixFSError) MarshalToSizedBufferVT(dAtA []byte) (int, error)

func (*UnixFSError) MarshalToVT

func (m *UnixFSError) MarshalToVT(dAtA []byte) (int, error)

func (*UnixFSError) MarshalVT

func (m *UnixFSError) MarshalVT() (dAtA []byte, err error)

func (*UnixFSError) ProtoMessage

func (*UnixFSError) ProtoMessage()

func (*UnixFSError) Reset

func (x *UnixFSError) Reset()

func (*UnixFSError) SizeVT

func (m *UnixFSError) SizeVT() (n int)

func (*UnixFSError) String

func (x *UnixFSError) String() string

func (*UnixFSError) ToGoError

func (e *UnixFSError) ToGoError() error

ToGoError converts a UnixFSError into the corresponding Go error from unixfs_errors.

func (*UnixFSError) UnmarshalJSON

func (x *UnixFSError) UnmarshalJSON(b []byte) error

UnmarshalJSON unmarshals the UnixFSError from JSON.

func (*UnixFSError) UnmarshalProtoJSON

func (x *UnixFSError) UnmarshalProtoJSON(s *json.UnmarshalState)

UnmarshalProtoJSON unmarshals the UnixFSError message from JSON.

func (*UnixFSError) UnmarshalVT

func (m *UnixFSError) UnmarshalVT(dAtA []byte) error

type UnixFSErrorType

type UnixFSErrorType int32

UnixFSErrorType contains all potential UnixFS errors.

const (
	// NONE indicates no error.
	UnixFSErrorType_NONE UnixFSErrorType = 0
	// OTHER corresponds to a string error not defined in the unixfs errors list.
	UnixFSErrorType_OTHER UnixFSErrorType = 1
	// FS_NOT_FOUND corresponds to unixfs_errors.ErrFsNotFound.
	UnixFSErrorType_FS_NOT_FOUND UnixFSErrorType = 2
	// EXIST corresponds to unixfs_errors.ErrExist.
	UnixFSErrorType_EXIST UnixFSErrorType = 3
	// NOT_EXIST corresponds to unixfs_errors.ErrNotExist.
	UnixFSErrorType_NOT_EXIST UnixFSErrorType = 4
	// CLOSED corresponds to unixfs_errors.ErrClosed.
	UnixFSErrorType_CLOSED UnixFSErrorType = 5
	// READ_ONLY corresponds to unixfs_errors.ErrReadOnly.
	UnixFSErrorType_READ_ONLY UnixFSErrorType = 6
	// RELEASED corresponds to unixfs_errors.ErrReleased.
	UnixFSErrorType_RELEASED UnixFSErrorType = 7
	// NOT_DIRECTORY corresponds to unixfs_errors.ErrNotDirectory.
	UnixFSErrorType_NOT_DIRECTORY UnixFSErrorType = 8
	// NOT_FILE corresponds to unixfs_errors.ErrNotFile.
	UnixFSErrorType_NOT_FILE UnixFSErrorType = 9
	// OUT_OF_BOUNDS corresponds to unixfs_errors.ErrOutOfBounds.
	UnixFSErrorType_OUT_OF_BOUNDS UnixFSErrorType = 10
	// EMPTY_PATH corresponds to unixfs_errors.ErrEmptyPath.
	UnixFSErrorType_EMPTY_PATH UnixFSErrorType = 11
	// ABSOLUTE_PATH corresponds to unixfs_errors.ErrAbsolutePath.
	UnixFSErrorType_ABSOLUTE_PATH UnixFSErrorType = 12
	// INODE_UNRESOLVABLE corresponds to unixfs_errors.ErrInodeUnresolvable.
	UnixFSErrorType_INODE_UNRESOLVABLE UnixFSErrorType = 13
	// NOT_SYMLINK corresponds to unixfs_errors.ErrNotSymlink.
	UnixFSErrorType_NOT_SYMLINK UnixFSErrorType = 14
	// EMPTY_TIMESTAMP corresponds to unixfs_errors.ErrEmptyTimestamp.
	UnixFSErrorType_EMPTY_TIMESTAMP UnixFSErrorType = 15
	// MOVE_TO_SELF corresponds to unixfs_errors.ErrMoveToSelf.
	UnixFSErrorType_MOVE_TO_SELF UnixFSErrorType = 16
	// INVALID_WRITE corresponds to unixfs_errors.ErrInvalidWrite.
	UnixFSErrorType_INVALID_WRITE UnixFSErrorType = 17
	// EMPTY_UNIXFS_ID corresponds to unixfs_errors.ErrEmptyUnixFsId.
	UnixFSErrorType_EMPTY_UNIXFS_ID UnixFSErrorType = 18
	// CROSS_FS_RENAME corresponds to unixfs_errors.ErrCrossFsRename.
	UnixFSErrorType_CROSS_FS_RENAME UnixFSErrorType = 21
	// CONTEXT_CANCELED corresponds to context.Canceled.
	UnixFSErrorType_CONTEXT_CANCELED UnixFSErrorType = 19
	// EOF corresponds to io.EOF.
	UnixFSErrorType_EOF UnixFSErrorType = 20
)

func (UnixFSErrorType) Enum

func (x UnixFSErrorType) Enum() *UnixFSErrorType

func (UnixFSErrorType) MarshalJSON

func (x UnixFSErrorType) MarshalJSON() ([]byte, error)

MarshalJSON marshals the UnixFSErrorType to JSON.

func (UnixFSErrorType) MarshalProtoJSON

func (x UnixFSErrorType) MarshalProtoJSON(s *json.MarshalState)

MarshalProtoJSON marshals the UnixFSErrorType to JSON.

func (UnixFSErrorType) MarshalProtoText

func (x UnixFSErrorType) MarshalProtoText() string

func (UnixFSErrorType) MarshalText

func (x UnixFSErrorType) MarshalText() ([]byte, error)

MarshalText marshals the UnixFSErrorType to text.

func (UnixFSErrorType) String

func (x UnixFSErrorType) String() string

func (*UnixFSErrorType) UnmarshalJSON

func (x *UnixFSErrorType) UnmarshalJSON(b []byte) error

UnmarshalJSON unmarshals the UnixFSErrorType from JSON.

func (*UnixFSErrorType) UnmarshalProtoJSON

func (x *UnixFSErrorType) UnmarshalProtoJSON(s *json.UnmarshalState)

UnmarshalProtoJSON unmarshals the UnixFSErrorType from JSON.

func (*UnixFSErrorType) UnmarshalText

func (x *UnixFSErrorType) UnmarshalText(b []byte) error

UnmarshalText unmarshals the UnixFSErrorType from text.

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL