github.com/enetx/g@v1.0.80/errors.go (about) 1 package g 2 3 import "fmt" 4 5 // ErrFileNotExist represents an error for when a file does not exist. 6 type ErrFileNotExist struct{ Msg string } 7 8 // Error returns the error message for ErrFileNotExist. 9 func (e *ErrFileNotExist) Error() string { 10 return fmt.Sprintf("no such file: %s", e.Msg) 11 } 12 13 // ErrFileClosed represents an error for when a file is already closed. 14 type ErrFileClosed struct{ Msg string } 15 16 // Error returns the error message for ErrFileClosed. 17 func (e *ErrFileClosed) Error() string { 18 return fmt.Sprintf("%s: file is already closed and unlocked", e.Msg) 19 }