From 513324a8e3e57da2669b6bfbd6c2326a6aeb8126 Mon Sep 17 00:00:00 2001 From: panaaj <38519157+panaaj@users.noreply.github.com> Date: Wed, 21 Aug 2024 14:00:02 +0930 Subject: [PATCH] Test for availability of getPluginsList() (#1777) Throw on error. --- src/index.ts | 13 ++++++++++--- 1 file changed, 10 insertions(+), 3 deletions(-) diff --git a/src/index.ts b/src/index.ts index 574a7d519..d053bb48c 100644 --- a/src/index.ts +++ b/src/index.ts @@ -132,9 +132,16 @@ class Server { // feature detection app.getFeatures = async (enabled?: boolean) => { - return { - apis: enabled === false ? [] : app.apis, - plugins: await app.getPluginsList(enabled) + if (typeof app.getPluginsList === 'function') { + return { + apis: enabled === false ? [] : app.apis, + plugins: await app.getPluginsList(enabled) + } + } else { + throw new Error(` + Plugin manager initialisation not complete! + Cannot call this function until all plugins have been initialised! + `) } }