You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@opendal.apache.org by "Xuanwo (via GitHub)" <gi...@apache.org> on 2023/08/18 15:21:15 UTC

[GitHub] [incubator-opendal] Xuanwo commented on a diff in pull request #2879: fix(oay): add some error handle

Xuanwo commented on code in PR #2879:
URL: https://github.com/apache/incubator-opendal/pull/2879#discussion_r1298577816


##########
bin/oay/src/services/webdav/webdav_file.rs:
##########
@@ -39,25 +39,28 @@ impl DavFile for WebdavFile {
     fn read_bytes(&mut self, count: usize) -> FsFuture<Bytes> {
         async move {
             let file_path = self.path.as_url_string();
-            let content = self
-                .op
+            self.op
                 .range_read(&file_path, 0..count as u64)
                 .await
-                .unwrap();
-            //error handle ?
-            Ok(Bytes::from(content))
+                .map_or_else(

Review Comment:
   The same.



##########
bin/oay/src/services/webdav/webdav_dir_entry.rs:
##########
@@ -35,8 +36,10 @@ impl DavDirEntry for WebDAVDirEntry {
 
     fn metadata(&self) -> dav_server::fs::FsFuture<Box<dyn dav_server::fs::DavMetaData>> {
         async move {
-            let metedata = self.op.stat(self.dir_entry.path()).await.unwrap();
-            Ok(Box::new(WebdavMetaData::new(metedata)) as Box<dyn DavMetaData>)
+            self.op.stat(self.dir_entry.path()).await.map_or_else(

Review Comment:
   How about `xxx.map_err(convert_error)?`?



-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: commits-unsubscribe@opendal.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org