Forráskód Böngészése

aws-s3-multipart: mention which method you need to implement in the error message, closes #2354

Renée Kooi 4 éve
szülő
commit
921013de28
1 módosított fájl, 7 hozzáadás és 7 törlés
  1. 7 7
      packages/@uppy/aws-s3-multipart/src/index.js

+ 7 - 7
packages/@uppy/aws-s3-multipart/src/index.js

@@ -68,14 +68,14 @@ module.exports = class AwsS3Multipart extends Plugin {
     }
     }
   }
   }
 
 
-  assertHost () {
+  assertHost (method) {
     if (!this.opts.companionUrl) {
     if (!this.opts.companionUrl) {
-      throw new Error('Expected a `companionUrl` option containing a Companion address.')
+      throw new Error(`Expected a \`companionUrl\` option containing a Companion address, or if you are not using Companion, a custom \`${method}\` implementation.`)
     }
     }
   }
   }
 
 
   createMultipartUpload (file) {
   createMultipartUpload (file) {
-    this.assertHost()
+    this.assertHost('createMultipartUpload')
 
 
     const metadata = {}
     const metadata = {}
 
 
@@ -93,7 +93,7 @@ module.exports = class AwsS3Multipart extends Plugin {
   }
   }
 
 
   listParts (file, { key, uploadId }) {
   listParts (file, { key, uploadId }) {
-    this.assertHost()
+    this.assertHost('listParts')
 
 
     const filename = encodeURIComponent(key)
     const filename = encodeURIComponent(key)
     return this.client.get(`s3/multipart/${uploadId}?key=${filename}`)
     return this.client.get(`s3/multipart/${uploadId}?key=${filename}`)
@@ -101,7 +101,7 @@ module.exports = class AwsS3Multipart extends Plugin {
   }
   }
 
 
   prepareUploadPart (file, { key, uploadId, number }) {
   prepareUploadPart (file, { key, uploadId, number }) {
-    this.assertHost()
+    this.assertHost('prepareUploadPart')
 
 
     const filename = encodeURIComponent(key)
     const filename = encodeURIComponent(key)
     return this.client.get(`s3/multipart/${uploadId}/${number}?key=${filename}`)
     return this.client.get(`s3/multipart/${uploadId}/${number}?key=${filename}`)
@@ -109,7 +109,7 @@ module.exports = class AwsS3Multipart extends Plugin {
   }
   }
 
 
   completeMultipartUpload (file, { key, uploadId, parts }) {
   completeMultipartUpload (file, { key, uploadId, parts }) {
-    this.assertHost()
+    this.assertHost('completeMultipartUpload')
 
 
     const filename = encodeURIComponent(key)
     const filename = encodeURIComponent(key)
     const uploadIdEnc = encodeURIComponent(uploadId)
     const uploadIdEnc = encodeURIComponent(uploadId)
@@ -118,7 +118,7 @@ module.exports = class AwsS3Multipart extends Plugin {
   }
   }
 
 
   abortMultipartUpload (file, { key, uploadId }) {
   abortMultipartUpload (file, { key, uploadId }) {
-    this.assertHost()
+    this.assertHost('abortMultipartUpload')
 
 
     const filename = encodeURIComponent(key)
     const filename = encodeURIComponent(key)
     const uploadIdEnc = encodeURIComponent(uploadId)
     const uploadIdEnc = encodeURIComponent(uploadId)