diff --git a/src/core/Core.js b/src/core/Core.js index 93c4ac9ef..6bc44978d 100644 --- a/src/core/Core.js +++ b/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. ' diff --git a/test/mocks/plugin-selecter1.js b/test/mocks/plugin-selecter1.js index 48fb7be40..f198fe096 100644 --- a/test/mocks/plugin-selecter1.js +++ b/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) { diff --git a/test/mocks/plugin-selecter2.js b/test/mocks/plugin-selecter2.js index 0100ca746..b0156f5ba 100644 --- a/test/mocks/plugin-selecter2.js +++ b/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) {