Print proper error messages for cp
This commit is contained in:
+2
-2
@@ -169,7 +169,7 @@ func prepareCopyURLsTypeA(sourceURL string, targetURL string) *copyURLs {
|
||||
sourceContent, err := sourceClient.Stat()
|
||||
if err != nil {
|
||||
// Source does not exist or insufficient privileges.
|
||||
return ©URLs{Error: iodine.New(errInvalidSource{path: sourceURL}, nil)}
|
||||
return ©URLs{Error: iodine.New(err, nil)}
|
||||
}
|
||||
if !sourceContent.Type.IsRegular() {
|
||||
// Source is not a regular file
|
||||
@@ -205,7 +205,7 @@ func prepareCopyURLsTypeB(sourceURL string, targetURL string) *copyURLs {
|
||||
sourceContent, err := sourceClient.Stat()
|
||||
if err != nil {
|
||||
// Source does not exist or insufficient privileges.
|
||||
return ©URLs{Error: iodine.New(errInvalidSource{path: sourceURL}, nil)}
|
||||
return ©URLs{Error: iodine.New(err, nil)}
|
||||
}
|
||||
|
||||
if !sourceContent.Type.IsRegular() {
|
||||
|
||||
@@ -25,19 +25,19 @@ type GenericFileError struct {
|
||||
type NotFound GenericFileError
|
||||
|
||||
func (e NotFound) Error() string {
|
||||
return "Requested file " + e.path + " not found"
|
||||
return "Requested file [" + e.path + "] not found"
|
||||
}
|
||||
|
||||
// ISFolder (EISDIR) - accessed file is a folder
|
||||
type ISFolder GenericFileError
|
||||
|
||||
func (e ISFolder) Error() string {
|
||||
return "Requested file " + e.path + " is a folder"
|
||||
return "Requested file [" + e.path + "] is a folder"
|
||||
}
|
||||
|
||||
// NotFolder (ENOTDIR) - accessed file is not a folder
|
||||
type NotFolder GenericFileError
|
||||
|
||||
func (e NotFolder) Error() string {
|
||||
return "Requested file " + e.path + " is not a folder"
|
||||
return "Requested file [" + e.path + "] is not a folder"
|
||||
}
|
||||
|
||||
+2
-2
@@ -57,7 +57,7 @@ func (f *fsClient) fsStat() (os.FileInfo, error) {
|
||||
// Resolve symlinks
|
||||
fpath, err := filepath.EvalSymlinks(f.path)
|
||||
if os.IsNotExist(err) {
|
||||
return nil, iodine.New(NotFound{path: fpath}, nil)
|
||||
return nil, iodine.New(NotFound{path: f.path}, nil)
|
||||
}
|
||||
if err != nil {
|
||||
return nil, iodine.New(err, nil)
|
||||
@@ -154,7 +154,7 @@ func (f *fsClient) list(contentCh chan client.ContentOnChannel) {
|
||||
if os.IsNotExist(err) {
|
||||
contentCh <- client.ContentOnChannel{
|
||||
Content: nil,
|
||||
Err: iodine.New(NotFound{path: fpath}, nil),
|
||||
Err: iodine.New(NotFound{path: f.path}, nil),
|
||||
}
|
||||
return
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user