Add specific errors for the failures, resulting in this rather than just the generic "invalid filename": [MRIW7] 08:50:50 INFO: Puller (folder default, item "NUL"): syncing: filename is invalid: name is reserved [MRIW7] 08:50:50 INFO: Puller (folder default, item "fail."): syncing: filename is invalid: name ends with space or period [MRIW7] 08:50:50 INFO: Puller (folder default, item "sup:yo"): syncing: filename is invalid: name contains reserved character [MRIW7] 08:50:50 INFO: default: Failed to sync 3 items
This commit is contained in:
+6
-3
@@ -19,8 +19,11 @@ import (
|
||||
)
|
||||
|
||||
var (
|
||||
ErrInvalidFilename = errors.New("filename is invalid")
|
||||
ErrNotRelative = errors.New("not a relative path")
|
||||
errInvalidFilenameEmpty = errors.New("name is invalid, must not be empty")
|
||||
errInvalidFilenameWindowsSpacePeriod = errors.New("name is invalid, must not end in space or period on Windows")
|
||||
errInvalidFilenameWindowsReservedName = errors.New("name is invalid, contains Windows reserved name (NUL, COM1, etc.)")
|
||||
errInvalidFilenameWindowsReservedChar = errors.New("name is invalid, contains Windows reserved character (?, *, etc.)")
|
||||
errNotRelative = errors.New("not a relative path")
|
||||
)
|
||||
|
||||
func WithJunctionsAsDirs() Option {
|
||||
@@ -95,7 +98,7 @@ func (f *BasicFilesystem) rooted(rel string) (string, error) {
|
||||
func rooted(rel, root string) (string, error) {
|
||||
// The root must not be empty.
|
||||
if root == "" {
|
||||
return "", ErrInvalidFilename
|
||||
return "", errInvalidFilenameEmpty
|
||||
}
|
||||
|
||||
var err error
|
||||
|
||||
Reference in New Issue
Block a user