Skip to content
Projects
Groups
Snippets
Help
This project
Loading...
Sign in / Register
Toggle navigation
P
pyfs
Overview
Overview
Details
Activity
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Board
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Charts
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
OpenEdx
pyfs
Commits
974e63d7
Commit
974e63d7
authored
Sep 03, 2009
by
rfkelly0
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
report correct line numbers in various error decorators
parent
34c1d36a
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
16 additions
and
13 deletions
+16
-13
fs/errors.py
+13
-12
fs/wrapfs.py
+3
-1
No files found.
fs/errors.py
View file @
974e63d7
...
@@ -159,36 +159,37 @@ def convert_os_errors(func):
...
@@ -159,36 +159,37 @@ def convert_os_errors(func):
try
:
try
:
return
func
(
self
,
*
args
,
**
kwds
)
return
func
(
self
,
*
args
,
**
kwds
)
except
(
OSError
,
IOError
),
e
:
except
(
OSError
,
IOError
),
e
:
(
exc_type
,
exc_inst
,
tb
)
=
sys
.
exc_info
()
path
=
getattr
(
e
,
"filename"
,
None
)
path
=
getattr
(
e
,
"filename"
,
None
)
if
path
and
path
[
0
]
==
"/"
and
hasattr
(
self
,
"root_path"
):
if
path
and
path
[
0
]
==
"/"
and
hasattr
(
self
,
"root_path"
):
path
=
normpath
(
path
)
path
=
normpath
(
path
)
if
isprefix
(
self
.
root_path
,
path
):
if
isprefix
(
self
.
root_path
,
path
):
path
=
path
[
len
(
self
.
root_path
):]
path
=
path
[
len
(
self
.
root_path
):]
if
not
hasattr
(
e
,
"errno"
)
or
not
e
.
errno
:
if
not
hasattr
(
e
,
"errno"
)
or
not
e
.
errno
:
raise
OperationFailedError
(
opname
,
details
=
e
)
raise
OperationFailedError
(
opname
,
details
=
e
)
,
None
,
tb
if
e
.
errno
==
errno
.
ENOENT
:
if
e
.
errno
==
errno
.
ENOENT
:
raise
ResourceNotFoundError
(
path
,
opname
=
opname
,
details
=
e
)
raise
ResourceNotFoundError
(
path
,
opname
=
opname
,
details
=
e
)
,
None
,
tb
if
e
.
errno
==
errno
.
ENOTEMPTY
:
if
e
.
errno
==
errno
.
ENOTEMPTY
:
raise
DirectoryNotEmptyError
(
path
,
opname
=
opname
,
details
=
e
)
raise
DirectoryNotEmptyError
(
path
,
opname
=
opname
,
details
=
e
)
,
None
,
tb
if
e
.
errno
==
errno
.
EEXIST
:
if
e
.
errno
==
errno
.
EEXIST
:
raise
DestinationExistsError
(
path
,
opname
=
opname
,
details
=
e
)
raise
DestinationExistsError
(
path
,
opname
=
opname
,
details
=
e
)
,
None
,
tb
if
e
.
errno
==
183
:
# some sort of win32 equivalent to EEXIST
if
e
.
errno
==
183
:
# some sort of win32 equivalent to EEXIST
raise
DestinationExistsError
(
path
,
opname
=
opname
,
details
=
e
)
raise
DestinationExistsError
(
path
,
opname
=
opname
,
details
=
e
)
,
None
,
tb
if
e
.
errno
==
errno
.
ENOTDIR
:
if
e
.
errno
==
errno
.
ENOTDIR
:
raise
ResourceInvalidError
(
path
,
opname
=
opname
,
details
=
e
)
raise
ResourceInvalidError
(
path
,
opname
=
opname
,
details
=
e
)
,
None
,
tb
if
e
.
errno
==
errno
.
EISDIR
:
if
e
.
errno
==
errno
.
EISDIR
:
raise
ResourceInvalidError
(
path
,
opname
=
opname
,
details
=
e
)
raise
ResourceInvalidError
(
path
,
opname
=
opname
,
details
=
e
)
,
None
,
tb
if
e
.
errno
==
errno
.
EINVAL
:
if
e
.
errno
==
errno
.
EINVAL
:
raise
ResourceInvalidError
(
path
,
opname
=
opname
,
details
=
e
)
raise
ResourceInvalidError
(
path
,
opname
=
opname
,
details
=
e
)
,
None
,
tb
if
e
.
errno
==
errno
.
EOPNOTSUPP
:
if
e
.
errno
==
errno
.
EOPNOTSUPP
:
raise
UnsupportedError
(
opname
,
details
=
e
)
raise
UnsupportedError
(
opname
,
details
=
e
)
,
None
,
tb
if
e
.
errno
==
errno
.
ENOSPC
:
if
e
.
errno
==
errno
.
ENOSPC
:
raise
StorageSpaceError
(
opname
,
details
=
e
)
raise
StorageSpaceError
(
opname
,
details
=
e
)
,
None
,
tb
# Sometimes windows gives some random errors...
# Sometimes windows gives some random errors...
if
sys
.
platform
==
"win32"
:
if
sys
.
platform
==
"win32"
:
if
e
.
errno
in
(
13
,):
if
e
.
errno
in
(
13
,):
raise
ResourceInvalidError
(
path
,
opname
=
opname
,
details
=
e
)
raise
ResourceInvalidError
(
path
,
opname
=
opname
,
details
=
e
)
,
None
,
tb
raise
OperationFailedError
(
opname
,
details
=
e
)
raise
OperationFailedError
(
opname
,
details
=
e
)
,
None
,
tb
return
wrapper
return
wrapper
fs/wrapfs.py
View file @
974e63d7
...
@@ -13,6 +13,7 @@ directory listings.
...
@@ -13,6 +13,7 @@ directory listings.
"""
"""
import
sys
from
fnmatch
import
fnmatch
from
fnmatch
import
fnmatch
from
fs.base
import
FS
,
threading
,
synchronize
from
fs.base
import
FS
,
threading
,
synchronize
...
@@ -24,10 +25,11 @@ def rewrite_errors(func):
...
@@ -24,10 +25,11 @@ def rewrite_errors(func):
try
:
try
:
return
func
(
self
,
*
args
,
**
kwds
)
return
func
(
self
,
*
args
,
**
kwds
)
except
ResourceError
,
e
:
except
ResourceError
,
e
:
(
exc_type
,
exc_inst
,
tb
)
=
sys
.
exc_info
()
try
:
try
:
e
.
path
=
self
.
_decode
(
e
.
path
)
e
.
path
=
self
.
_decode
(
e
.
path
)
except
(
AttributeError
,
ValueError
,
TypeError
):
except
(
AttributeError
,
ValueError
,
TypeError
):
raise
e
raise
e
,
None
,
tb
raise
raise
return
wrapper
return
wrapper
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment