Skip to content

Commit 2e322ad

Browse files
committed
cs3iface: catch UnknownException in Stat (should be handled upstream)
1 parent 23c7c01 commit 2e322ad

File tree

1 file changed

+9
-2
lines changed

1 file changed

+9
-2
lines changed

src/core/cs3iface.py

Lines changed: 9 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -80,8 +80,15 @@ def authenticate_for_test(userid, userpwd):
8080

8181

8282
def stat(endpoint, fileref, userid):
83-
resource = Resource.from_file_ref_and_endpoint(fileref, endpoint)
84-
statInfo = client.file.stat(Auth.check_token(userid), resource)
83+
try:
84+
resource = Resource.from_file_ref_and_endpoint(fileref, endpoint)
85+
statInfo = client.file.stat(Auth.check_token(userid), resource)
86+
except cs3client.exceptions.UnknownException as e:
87+
log.error(
88+
'msg="Invoked stat" endpoint="%s" fileref="%s" exception="%s"' %
89+
(endpoint, fileref, str(e).replace('\n', ' '))
90+
)
91+
raise IOError(f"Stat failed for {fileref}") from e
8592
if statInfo.type == cs3spr.RESOURCE_TYPE_CONTAINER:
8693
log.info(
8794
'msg="Invoked stat" endpoint="%s" fileref="%s" trace="%s" result="ISDIR"'

0 commit comments

Comments
 (0)