Print proper error messages for cp

This commit is contained in:
Harshavardhana
2015-05-16 18:42:22 -07:00
parent 02eca69929
commit de92f4ef31
3 changed files with 7 additions and 7 deletions
+2 -2
View File
@@ -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 &copyURLs{Error: iodine.New(errInvalidSource{path: sourceURL}, nil)}
return &copyURLs{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 &copyURLs{Error: iodine.New(errInvalidSource{path: sourceURL}, nil)}
return &copyURLs{Error: iodine.New(err, nil)}
}
if !sourceContent.Type.IsRegular() {
+3 -3
View File
@@ -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
View File
@@ -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
}