Skip to content

Commit

Permalink
Test for availability of getPluginsList() (#1777)
Browse files Browse the repository at this point in the history
Throw on error.
  • Loading branch information
panaaj committed Aug 21, 2024
1 parent 7f79aef commit 513324a
Showing 1 changed file with 10 additions and 3 deletions.
13 changes: 10 additions & 3 deletions src/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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!
`)
}
}

Expand Down

0 comments on commit 513324a

Please sign in to comment.