Kevin van Zonneveld před 9 roky
rodič
revize
e4e80931ba

+ 4 - 2
src/core/Core.js

@@ -48,7 +48,7 @@ export default class Core {
     const plugin = new Plugin(this, opts)
     this.plugins[plugin.type] = this.plugins[plugin.type] || []
 
-    if (!plugin.name) {
+    if (!plugin.constructor.name) {
       throw new Error('Your plugin must have a name')
     }
     if (!plugin.type) {
@@ -57,7 +57,9 @@ export default class Core {
 
     let existsPluginAlready = this.getPlugin(plugin.constructor.name)
     if (existsPluginAlready) {
-      let msg = 'Uppy is currently limited to running one of every plugin. '
+      let msg = `Already found a plugin named '${existsPluginAlready.name}'. `
+      msg += `Tried to use: '${plugin.constructor.name}'. `
+      msg += 'Uppy is currently limited to running one of every plugin. '
       msg += 'Share your use case with us over at '
       msg += 'https://github.com/transloadit/uppy/issues/ '
       msg += 'if you want us to reconsider. '

+ 2 - 2
test/mocks/plugin-selecter1.js

@@ -1,10 +1,10 @@
 const Plugin = require('../../src/plugins/Plugin.js')
 
-export default class TestSelector extends Plugin {
+export default class TestSelector1 extends Plugin {
   constructor (core, opts) {
     super(core, opts)
     this.type = 'selecter'
-    this.name = 'selecter1'
+    this.name = this.constructor.name
   }
 
   run (results) {

+ 2 - 2
test/mocks/plugin-selecter2.js

@@ -1,10 +1,10 @@
 const Plugin = require('../../src/plugins/Plugin.js')
 
-export default class TestSelector extends Plugin {
+export default class TestSelector2 extends Plugin {
   constructor (core, opts) {
     super(core, opts)
     this.type = 'selecter'
-    this.name = 'selecter2'
+    this.name = this.constructor.name
   }
 
   run (results) {