瀏覽代碼

Remote file error handling

Harry Hedger 9 年之前
父節點
當前提交
b0b9ab089b
共有 1 個文件被更改,包括 6 次插入1 次删除
  1. 6 1
      src/plugins/Tus10.js

+ 6 - 1
src/plugins/Tus10.js

@@ -111,7 +111,12 @@ export default class Tus10 extends Plugin {
         }
         }
       })
       })
       .then((res) => {
       .then((res) => {
-        console.log(res)
+        if (res.status >= 200 && res.status <= 300) {
+          this.core.log(`Remote upload of '${file.name}' successful`)
+          return resolve('Success')
+        }
+        this.core.log(`Remote upload of file '${file.name}' failed`)
+        return reject(new Error('Error: ' + res.statusText))
       })
       })
     })
     })
   }
   }