From 5d59b7e733acdc4f489683d88370dc7890768766 Mon Sep 17 00:00:00 2001 From: David Taylor Date: Fri, 26 Nov 2021 20:22:29 +0000 Subject: [PATCH] DEV: Make plugin api errors more descriptive (#15111) With more descriptive errors, developers will know **why** a change is required, and may be more likely to take action. --- app/assets/javascripts/discourse/app/lib/plugin-api.js | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/app/assets/javascripts/discourse/app/lib/plugin-api.js b/app/assets/javascripts/discourse/app/lib/plugin-api.js index b897b219f4e..d11adef5f16 100644 --- a/app/assets/javascripts/discourse/app/lib/plugin-api.js +++ b/app/assets/javascripts/discourse/app/lib/plugin-api.js @@ -102,7 +102,7 @@ function canModify(klass, type, resolverName, changes) { if (!changes.pluginId) { // eslint-disable-next-line no-console console.warn( - "To prevent errors, add a `pluginId` key to your changes when calling `modifyClass`" + "To prevent errors in tests, add a `pluginId` key to your `modifyClass` call. This will ensure the modification is only applied once." ); return true; } @@ -1629,7 +1629,7 @@ function decorate(klass, evt, cb, id) { if (!id) { // eslint-disable-next-line no-console console.warn( - "`decorateCooked` should be supplied with an `id` option to avoid memory leaks." + "`decorateCooked` should be supplied with an `id` option to avoid memory leaks in test mode. The id will be used to ensure the decorator is only applied once." ); } else { if (!_decorated.has(klass)) {