Documentation
¶
Overview ¶
Package fs provides error constructors for filesystem operations.
Index ¶
- func BoundaryViolation(cause error) error
- func CreateDir(dir string, cause error) error
- func DirNotFound(dir string) error
- func FileAmend(path string, cause error) error
- func FileRead(path string, cause error) error
- func FileUpdate(path string, cause error) error
- func FileWrite(path string, cause error) error
- func Mkdir(desc string, cause error) error
- func NoInput() error
- func NotDirectory(path string) error
- func OpenFile(path string, cause error) error
- func PathEscapesBase(filename string) error
- func ReadDir(desc string, cause error) error
- func ReadDirectory(path string, cause error) error
- func ReadFile(cause error) error
- func ReadInput(cause error) error
- func ReadInputStream(cause error) error
- func RefuseSystemPath(path string) error
- func RefuseSystemPathRoot() error
- func ResolveBase(cause error) error
- func ResolvePath(cause error) error
- func StatPath(path string, cause error) error
- func WorkingDirectory(cause error) error
- func WriteFileFailed(cause error) error
- func WriteMerged(path string, cause error) error
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func BoundaryViolation ¶
BoundaryViolation wraps a boundary validation error with a hint to use --allow-outside-cwd.
Parameters:
- cause: the underlying validation error
Returns:
- error: "<cause>\nUse --allow-outside-cwd to override this check"
func CreateDir ¶
CreateDir wraps a directory creation failure.
Parameters:
- dir: the directory path that could not be created
- cause: the underlying error
Returns:
- error: "failed to create directory <dir>: <cause>"
func DirNotFound ¶
DirNotFound returns an error when a directory does not exist.
Parameters:
- dir: the missing directory path.
Returns:
- error: "directory not found: <dir>"
func FileAmend ¶
FileAmend wraps a failure to amend an existing file.
Parameters:
- path: file path that could not be amended
- cause: the underlying OS error
Returns:
- error: "failed to amend <path>: <cause>"
func FileRead ¶
FileRead wraps a file read failure with path context.
Parameters:
- path: file path that could not be read.
- cause: the underlying OS error.
Returns:
- error: "failed to read <path>: <cause>"
func FileUpdate ¶
FileUpdate wraps a failure to update a file.
Parameters:
- path: file path that could not be updated
- cause: the underlying OS error
Returns:
- error: "failed to update <path>: <cause>"
func FileWrite ¶
FileWrite wraps a file write failure.
Parameters:
- path: file path that could not be written.
- cause: the underlying OS error.
Returns:
- error: "failed to write <path>: <cause>"
func Mkdir ¶
Mkdir wraps a directory creation failure.
Parameters:
- desc: human description of the directory (e.g. "journal directory").
- cause: the underlying OS error.
Returns:
- error: "failed to create <desc>: <cause>"
func NoInput ¶
func NoInput() error
NoInput returns an error for missing stdin input.
Returns:
- error: "no input received"
func NotDirectory ¶
NotDirectory returns an error when a path is not a directory.
Parameters:
- path: the path.
Returns:
- error: "<path> is not a directory"
func OpenFile ¶
OpenFile wraps a file open failure.
Parameters:
- path: the file path.
- cause: the underlying OS error.
Returns:
- error: "open <path>: <cause>"
func PathEscapesBase ¶
PathEscapesBase returns an error when a path escapes its base directory.
Parameters:
- filename: the offending filename
Returns:
- error: "path escapes base directory: <filename>"
func ReadDir ¶
ReadDir wraps a directory read failure.
Parameters:
- desc: human description of the directory (e.g. "journal directory").
- cause: the underlying OS error.
Returns:
- error: "read <desc>: <cause>"
func ReadDirectory ¶
ReadDirectory wraps a directory read failure.
Parameters:
- path: the directory path.
- cause: the underlying OS error.
Returns:
- error: "read directory <path>: <cause>"
func ReadFile ¶
ReadFile wraps a file read failure.
Parameters:
- cause: the underlying read error.
Returns:
- error: "read file: <cause>"
func ReadInput ¶
ReadInput wraps a failure to read user input.
Parameters:
- cause: the underlying error from the read operation.
Returns:
- error: "failed to read input: <cause>"
func ReadInputStream ¶
ReadInputStream wraps a failure to read from the input stream.
Parameters:
- cause: the underlying read error.
Returns:
- error: "error reading input: <cause>"
func RefuseSystemPath ¶
RefuseSystemPath returns an error when access to a system path is refused.
Parameters:
- path: the system path being refused
Returns:
- error: "refusing to access system path: <path>"
func RefuseSystemPathRoot ¶
func RefuseSystemPathRoot() error
RefuseSystemPathRoot returns an error when access to "/" is refused.
Returns:
- error: "refusing to access system path: /"
func ResolveBase ¶
ResolveBase wraps a failure to resolve a base directory path.
Parameters:
- cause: the underlying resolution error
Returns:
- error: "resolve base: <cause>"
func ResolvePath ¶
ResolvePath wraps a failure to resolve a file path.
Parameters:
- cause: the underlying resolution error
Returns:
- error: "resolve path: <cause>"
func StatPath ¶
StatPath wraps a stat failure.
Parameters:
- path: the path that failed.
- cause: the underlying OS error.
Returns:
- error: "stat <path>: <cause>"
func WorkingDirectory ¶
WorkingDirectory wraps a failure to determine the working directory.
Parameters:
- cause: the underlying error from os.Getwd
Returns:
- error: "failed to get working directory: <cause>"
func WriteFileFailed ¶
WriteFileFailed wraps a file write failure.
Parameters:
- cause: the underlying write error.
Returns:
- error: "write file: <cause>"
func WriteMerged ¶
WriteMerged wraps a failure to write a merged file.
Parameters:
- path: file path that could not be written
- cause: the underlying OS error
Returns:
- error: "failed to write merged <path>: <cause>"
Types ¶
This section is empty.