Skip to content

Commit 468373d

Browse files
fridolin-kochshuLhan
authored andcommitted
Use os.PathError for more information regarding the error
1 parent 93a9a8b commit 468373d

File tree

1 file changed

+4
-4
lines changed

1 file changed

+4
-4
lines changed

toc.go

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -114,12 +114,12 @@ func AssetDir(name string) ([]string, error) {
114114
for _, p := range pathList {
115115
node = node.Children[p]
116116
if node == nil {
117-
return nil, os.ErrNotExist
117+
return nil, &os.PathError{Op: "open", Path: name, Err: os.ErrNotExist}
118118
}
119119
}
120120
}
121121
if node.Func != nil {
122-
return nil, os.ErrNotExist
122+
return nil, &os.PathError{Op: "open", Path: name, Err: os.ErrNotExist}
123123
}
124124
rv := make([]string, 0, len(node.Children))
125125
for childName := range node.Children {
@@ -171,7 +171,7 @@ func Asset(name string) ([]byte, error) {
171171
}
172172
return a.bytes, nil
173173
}
174-
return nil, os.ErrNotExist
174+
return nil, &os.PathError{Op: "open", Path: name, Err: os.ErrNotExist}
175175
}
176176
177177
// MustAsset is like Asset but panics when Asset would return an error.
@@ -197,7 +197,7 @@ func AssetInfo(name string) (os.FileInfo, error) {
197197
}
198198
return a.info, nil
199199
}
200-
return nil, os.ErrNotExist
200+
return nil, &os.PathError{Op: "open", Path: name, Err: os.ErrNotExist}
201201
}
202202
203203
// AssetNames returns the names of the assets.

0 commit comments

Comments
 (0)