Browse Source

refactor: use plugin id in error message

Ifedapo Olarewaju 6 years ago
parent
commit
c6ba46d6e2

+ 1 - 1
packages/@uppy/dropbox/src/index.js

@@ -7,8 +7,8 @@ const { h } = require('preact')
 module.exports = class Dropbox extends Plugin {
   constructor (uppy, opts) {
     super(uppy, opts)
-    Provider.initPlugin(this, opts)
     this.id = this.opts.id || 'Dropbox'
+    Provider.initPlugin(this, opts)
     this.title = 'Dropbox'
     this.icon = () => (
       <svg class="UppyIcon" width="128" height="118" viewBox="0 0 128 118">

+ 1 - 1
packages/@uppy/google-drive/src/index.js

@@ -6,8 +6,8 @@ const { h } = require('preact')
 module.exports = class GoogleDrive extends Plugin {
   constructor (uppy, opts) {
     super(uppy, opts)
-    Provider.initPlugin(this, opts)
     this.id = this.opts.id || 'GoogleDrive'
+    Provider.initPlugin(this, opts)
     this.title = 'Google Drive'
     this.icon = () =>
       <svg aria-hidden="true" class="UppyIcon UppyModalTab-icon" width="28" height="28" viewBox="0 0 16 16">

+ 1 - 1
packages/@uppy/instagram/src/index.js

@@ -6,8 +6,8 @@ const { h } = require('preact')
 module.exports = class Instagram extends Plugin {
   constructor (uppy, opts) {
     super(uppy, opts)
-    Provider.initPlugin(this, opts)
     this.id = this.opts.id || 'Instagram'
+    Provider.initPlugin(this, opts)
     this.title = 'Instagram'
     this.icon = () => (
       <svg aria-hidden="true" class="UppyIcon" width="28" height="28" viewBox="0 0 512 512">

+ 1 - 1
packages/@uppy/server-utils/src/Provider.js

@@ -63,7 +63,7 @@ module.exports = class Provider extends RequestClient {
       const pattern = opts.serverPattern
       // validate serverPattern param
       if (typeof pattern !== 'string' && !Array.isArray(pattern) && !(pattern instanceof RegExp)) {
-        throw new TypeError('Provider: the option `serverPattern` must be one of string, Array, RegExp')
+        throw new TypeError(`${plugin.id}: the option "serverPattern" must be one of string, Array, RegExp`)
       }
       plugin.opts.serverPattern = pattern
     } else {