Skip to content

Commit

Permalink
Use os.PathError for more information regarding the error
Browse files Browse the repository at this point in the history
  • Loading branch information
fridolin-koch authored and shuLhan committed Sep 9, 2017
1 parent 93a9a8b commit 468373d
Showing 1 changed file with 4 additions and 4 deletions.
8 changes: 4 additions & 4 deletions toc.go
Expand Up @@ -114,12 +114,12 @@ func AssetDir(name string) ([]string, error) {
for _, p := range pathList {
node = node.Children[p]
if node == nil {
return nil, os.ErrNotExist
return nil, &os.PathError{Op: "open", Path: name, Err: os.ErrNotExist}
}
}
}
if node.Func != nil {
return nil, os.ErrNotExist
return nil, &os.PathError{Op: "open", Path: name, Err: os.ErrNotExist}
}
rv := make([]string, 0, len(node.Children))
for childName := range node.Children {
Expand Down Expand Up @@ -171,7 +171,7 @@ func Asset(name string) ([]byte, error) {
}
return a.bytes, nil
}
return nil, os.ErrNotExist
return nil, &os.PathError{Op: "open", Path: name, Err: os.ErrNotExist}
}
// MustAsset is like Asset but panics when Asset would return an error.
Expand All @@ -197,7 +197,7 @@ func AssetInfo(name string) (os.FileInfo, error) {
}
return a.info, nil
}
return nil, os.ErrNotExist
return nil, &os.PathError{Op: "open", Path: name, Err: os.ErrNotExist}
}
// AssetNames returns the names of the assets.
Expand Down

0 comments on commit 468373d

Please sign in to comment.