From 8064ea6c6b355b0938aae9bda8fd596b9f561676 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Maur=C3=ADcio=20Szabo?= Date: Sun, 5 May 2024 20:40:55 -0300 Subject: [PATCH] Debugging when a package service is incorrect This PR is basically to add some debugging info for providers and consumers. Currently, when a package registers as a service provider or a service consumer, and doesn't actually implements the right interface (a function, basically) the package loader silently ignores it. This commit adds a warning to console so that we know a package did the wrong thing. --- src/package.js | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/src/package.js b/src/package.js index 0071472dc..1831e919d 100644 --- a/src/package.js +++ b/src/package.js @@ -428,6 +428,8 @@ module.exports = class Package { methodName = versions[version]; if (typeof this.mainModule[methodName] === 'function') { servicesByVersion[version] = this.mainModule[methodName](); + } else { + console.warn(`Package ${this.name} declares it provides ${name}@${version} but it doesn't expose a function in ${methodName}`) } } this.activationDisposables.add( @@ -447,6 +449,8 @@ module.exports = class Package { this.mainModule[methodName].bind(this.mainModule) ) ); + } else { + console.warn(`Package ${this.name} declares it consumes ${name}@${version} but it doesn't expose a function in ${methodName}`) } } }